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
4 changes: 3 additions & 1 deletion course_discovery/apps/core/tests/test_prod_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ def test_production_media_storage(monkeypatch, tmp_path):
AWS_QUERYSTRING_EXPIRE: false
AWS_S3_CUSTOM_DOMAIN: cdn.org
AWS_STORAGE_BUCKET_NAME: tests
DEFAULT_FILE_STORAGE: storages.backends.s3boto3.S3Boto3Storage
MEDIA_ROOT: media
MEDIA_URL: https://cdn.org/media/
STORAGES:
Copy link
Contributor

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.

default:
BACKEND: storages.backends.s3boto3.S3Boto3Storage
""")
fake_config.write_text(fake_yaml_content)

Expand Down
9 changes: 0 additions & 9 deletions course_discovery/settings/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,6 @@
vars().update(config_from_yaml)

MEDIA_STORAGE_BACKEND = config_from_yaml.get("MEDIA_STORAGE_BACKEND", {})
default_backend = MEDIA_STORAGE_BACKEND.pop("DEFAULT_FILE_STORAGE", None)
static_backend = MEDIA_STORAGE_BACKEND.pop("STATICFILES_STORAGE", None)

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

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

# Unpack media storage settings.
# It's important we unpack here because of https://github.com/openedx/configuration/pull/3307
vars().update(MEDIA_STORAGE_BACKEND)
Expand Down
Loading