Skip to main content

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

djangorescue-0.0.4.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

djangorescue-0.0.4-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

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

Hashes for djangorescue-0.0.4.tar.gz
Algorithm Hash digest
SHA256 076a83adc0eda5a2a51cd53778ccfb596d56477c0f8df6b527cf13ec6a3f62fd
MD5 d3f4a8034137c3de513ebc6824dea4ca
BLAKE2b-256 b97a1ea72146398a34d762ab77ee629c82d524988c78cb7af87a230216328da5

See more details on using hashes here.

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

Hashes for djangorescue-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 b345ca31ee5598c81267dad450af7730c383bde88e4bf78da00f8502bc801fe8
MD5 5be3a034536d8ade5dbf048fa6429544
BLAKE2b-256 63da05f6462622660bcd08b724af1b1977ca151762133c2c6ba9a84503cfec0b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page