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 = [
...
'djangorescue.middleware.StaticMediaMiddleware',
...
]
...
STATIC_URL = '/static/'
STATIC_APP_DIR = 'static' # Имя каталога со статикой внутри каталога приложения.
STATICFILES_DIRS = [
os.path.join(BASE_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) regardless of DEBUG setting value.
Yes, it is a known thing, that such approach is bad, however sometimes it's the only way.
Configuration
settings.py
DEBUG = False
...
MIDDLEWARE = [
...
'djangorescue.middleware.StaticMediaMiddleware',
...
]
...
STATIC_URL = '/static/'
STATIC_APP_DIR = 'static' # The name of the folder, that contains static files within the app folder.
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'static'),
]
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
Built Distribution
File details
Details for the file djangorescue-0.0.4.tar.gz
.
File metadata
- Download URL: djangorescue-0.0.4.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 076a83adc0eda5a2a51cd53778ccfb596d56477c0f8df6b527cf13ec6a3f62fd |
|
MD5 | d3f4a8034137c3de513ebc6824dea4ca |
|
BLAKE2b-256 | b97a1ea72146398a34d762ab77ee629c82d524988c78cb7af87a230216328da5 |
File details
Details for the file djangorescue-0.0.4-py3-none-any.whl
.
File metadata
- Download URL: djangorescue-0.0.4-py3-none-any.whl
- Upload date:
- Size: 3.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b345ca31ee5598c81267dad450af7730c383bde88e4bf78da00f8502bc801fe8 |
|
MD5 | 5be3a034536d8ade5dbf048fa6429544 |
|
BLAKE2b-256 | 63da05f6462622660bcd08b724af1b1977ca151762133c2c6ba9a84503cfec0b |