From 17b70ea4e5c3c1206248235ed6c986e19fd2e055 Mon Sep 17 00:00:00 2001 From: _ <50262751+hunzlahmalik@users.noreply.github.com> Date: Tue, 30 Sep 2025 02:34:52 +0500 Subject: [PATCH] feat: Upgrading storages with new dict Django52 --- notesserver/settings/yaml_config.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/notesserver/settings/yaml_config.py b/notesserver/settings/yaml_config.py index fe6e7dcc..ff0eae76 100644 --- a/notesserver/settings/yaml_config.py +++ b/notesserver/settings/yaml_config.py @@ -26,6 +26,25 @@ with open(CONFIG_ROOT / "edx_notes_api.yml") as yaml_file: config_from_yaml = yaml.safe_load(yaml_file) + +STORAGES = { + "default": { + "BACKEND": "django.core.files.storage.FileSystemStorage", + }, + "staticfiles": { + "BACKEND": "django.contrib.staticfiles.storage.StaticFilesStorage", + }, +} + + +default_file_storage = config_from_yaml.pop('DEFAULT_FILE_STORAGE', None) +staticfiles_storage = config_from_yaml.pop('STATICFILES_STORAGE', None) + +if default_file_storage: + STORAGES["default"]["BACKEND"] = default_file_storage +if staticfiles_storage: + STORAGES["staticfiles"]["BACKEND"] = staticfiles_storage + vars().update(config_from_yaml) # Support environment overrides for migrations