File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,6 +19,15 @@ def get_env_setting(setting):
1919 raise ImproperlyConfigured (error_msg )
2020
2121
22+ STORAGES = {
23+ "default" : {
24+ "BACKEND" : "django.core.files.storage.FileSystemStorage" ,
25+ },
26+ "staticfiles" : {
27+ "BACKEND" : "django.contrib.staticfiles.storage.StaticFilesStorage" ,
28+ },
29+ }
30+
2231# Keep track of the names of settings that represent dicts. Instead of overriding the values in settings.py,
2332# the values read from disk should UPDATE the pre-configured dicts.
2433DICT_UPDATE_KEYS = ()
@@ -35,6 +44,17 @@ def get_env_setting(setting):
3544 if value :
3645 vars ()[key ].update (value )
3746
47+ # Fallback for DEFAULT_FILE_STORAGE and STATICFILES_STORAGE settings.
48+ # If these keys are present in the YAML config, use them to override the default storage backends.
49+ default_backend = config_from_yaml .pop ('DEFAULT_FILE_STORAGE' , None )
50+ static_backend = config_from_yaml .pop ('STATICFILES_STORAGE' , None )
51+
52+ if default_backend :
53+ STORAGES ['default' ]['BACKEND' ] = default_backend
54+
55+ if static_backend :
56+ STORAGES ['staticfiles' ]['BACKEND' ] = static_backend
57+
3858 vars ().update (config_from_yaml )
3959
4060LOGGING = get_logger_config (LOG_DIR ,
You can’t perform that action at this time.
0 commit comments