Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions xqueue/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ def get_env_setting(setting):
raise ImproperlyConfigured(error_msg)


STORAGES = {
"default": {
"BACKEND": "django.core.files.storage.FileSystemStorage",
},
"staticfiles": {
"BACKEND": "django.contrib.staticfiles.storage.StaticFilesStorage",
},
}

# Keep track of the names of settings that represent dicts. Instead of overriding the values in settings.py,
# the values read from disk should UPDATE the pre-configured dicts.
DICT_UPDATE_KEYS = ()
Expand All @@ -35,6 +44,17 @@ def get_env_setting(setting):
if value:
vars()[key].update(value)

# Fallback for DEFAULT_FILE_STORAGE and STATICFILES_STORAGE settings.
# If these keys are present in the YAML config, use them to override the default storage backends.
default_backend = config_from_yaml.pop('DEFAULT_FILE_STORAGE', None)
static_backend = config_from_yaml.pop('STATICFILES_STORAGE', None)

if default_backend:
STORAGES['default']['BACKEND'] = default_backend

if static_backend:
STORAGES['staticfiles']['BACKEND'] = static_backend

vars().update(config_from_yaml)

LOGGING = get_logger_config(LOG_DIR,
Expand Down