Skip to content
Open
Show file tree
Hide file tree
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
10 changes: 0 additions & 10 deletions credentials/settings/devstack.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,6 @@
EMAIL_BACKEND = "django.core.mail.backends.filebased.EmailBackend"
EMAIL_FILE_PATH = "/tmp/credentials-emails"

defaultfile_storage = os.environ.get("DEFAULT_FILE_STORAGE")

if defaultfile_storage:
STORAGES["default"]["BACKEND"] = defaultfile_storage

staticfiles_storage = os.environ.get("STATICFILES_STORAGE")

if staticfiles_storage:
STORAGES["staticfiles"]["BACKEND"] = staticfiles_storage

MEDIA_URL = os.environ.get("MEDIA_URL", "/media/")
STATIC_URL = os.environ.get("STATIC_URL", "/static/")

Expand Down
10 changes: 1 addition & 9 deletions credentials/settings/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,11 @@
vars().update(config_from_yaml)

FILE_STORAGE_BACKEND = config_from_yaml.get("FILE_STORAGE_BACKEND", {})
default_backend = FILE_STORAGE_BACKEND.pop("DEFAULT_FILE_STORAGE", None)
Copy link
Contributor

@awais786 awais786 Dec 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without STORAGES dict inside prod yaml we cant make these changes. It will break production

static_backend = FILE_STORAGE_BACKEND.pop("STATICFILES_STORAGE", None)

# Load the files storage backend settings for django storages
# In django==4.2.24 following line sets the DEFAULT_FILE_STORAGE and other AWS variables as per YAML.
# In django==5.2.7 the following line sets AWS variables as per YAML.
vars().update(FILE_STORAGE_BACKEND)

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

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

# make sure this happens after the configuration file overrides so format string can be overridden
LOGGING = get_logger_config(format_string=LOGGING_FORMAT_STRING)

Expand Down