Skip to content

Commit ff54363

Browse files
hunzlahmalikfeanil
authored andcommitted
feat: Upgrading storages with new dict Django52
1 parent fc76170 commit ff54363

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

notesserver/settings/yaml_config.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,25 @@
2626
with open(CONFIG_ROOT / "edx_notes_api.yml") as yaml_file:
2727
config_from_yaml = yaml.safe_load(yaml_file)
2828

29+
30+
STORAGES = {
31+
"default": {
32+
"BACKEND": "django.core.files.storage.FileSystemStorage",
33+
},
34+
"staticfiles": {
35+
"BACKEND": "django.contrib.staticfiles.storage.StaticFilesStorage",
36+
},
37+
}
38+
39+
40+
default_file_storage = config_from_yaml.pop('DEFAULT_FILE_STORAGE', None)
41+
staticfiles_storage = config_from_yaml.pop('STATICFILES_STORAGE', None)
42+
43+
if default_file_storage:
44+
STORAGES["default"]["BACKEND"] = default_file_storage
45+
if staticfiles_storage:
46+
STORAGES["staticfiles"]["BACKEND"] = staticfiles_storage
47+
2948
vars().update(config_from_yaml)
3049

3150
# Support environment overrides for migrations

0 commit comments

Comments
 (0)