Package to let you serve static and media files via Django pipeline with DEBUG = False.
Project description
DJANGORESCUE
Описание по-русски.
Пакет DJANGORESCUE позволяет обслуживать статику (static, media) через Django (когда нет возможности использовать nginx, apache, и s3 storage) при отключенном DEBUG-режиме.
Да, это известно, что так делать не следует, но иногда по-другому нельзя.
Конфигурация
settings.py
DEBUG = False
...
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'djangorescue.middleware.StaticMediaMiddleware',
...
]
...
STATIC_URL = '/static/'
STATIC_APP_DIR = 'static' # Имя каталога со статикой внутри каталога приложения.
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
English description.
DJANGORESCUE package allows to serve static files (static, media) through Django (when nginx, apachage and s3 storage options are not available) when DEBUG-mode is turned off.
Yes, it is a known thing, that such approach is bad, however sometimes it's the only way.
Configuration
settings.py
DEBUG = False
...
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'djangorescue.middleware.StaticMediaMiddleware',
...
]
...
STATIC_URL = '/static/'
STATIC_APP_DIR = 'static' # The name of the folder, that contains static files within the app folder.
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
djangorescue-0.0.1.tar.gz
(2.8 kB
view hashes)
Built Distribution
Close
Hashes for djangorescue-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ca74d61ef5de58fe8697c8a29ba7d7510aee0876d41f99db6e73e28646b249fd |
|
MD5 | 05788e582a0f7f48acb4438f5584e915 |
|
BLAKE2b-256 | 6956ec1d6f1c8093e8559ceee2dec7df78b954f20ac09ae50ef7713d5da71fbf |