File tree Expand file tree Collapse file tree 4 files changed +31
-7
lines changed
Expand file tree Collapse file tree 4 files changed +31
-7
lines changed Original file line number Diff line number Diff line change 456456FILE_STORAGE_BACKEND = {}
457457EXTRA_APPS = []
458458SESSION_EXPIRE_AT_BROWSER_CLOSE = False
459- STATICFILES_STORAGE = "django.contrib.staticfiles.storage.ManifestStaticFilesStorage"
459+ STORAGES = {
460+ "default" : {
461+ "BACKEND" : "django.core.files.storage.FileSystemStorage" ,
462+ },
463+ "staticfiles" : {
464+ "BACKEND" : "django.contrib.staticfiles.storage.ManifestStaticFilesStorage" ,
465+ },
466+ }
460467CACHES = {
461468 "default" : {
462469 "BACKEND" : "django.core.cache.backends.locmem.LocMemCache" ,
474481}
475482API_ROOT = None
476483MEDIA_STORAGE_BACKEND = {
477- "DEFAULT_FILE_STORAGE " : "django.core.files.storage.FileSystemStorage" ,
484+ "STORAGES " : STORAGES ,
478485 "MEDIA_ROOT" : MEDIA_ROOT ,
479486 "MEDIA_URL" : MEDIA_URL ,
480487}
Original file line number Diff line number Diff line change 4343EMAIL_BACKEND = "django.core.mail.backends.filebased.EmailBackend"
4444EMAIL_FILE_PATH = "/tmp/credentials-emails"
4545
46- DEFAULT_FILE_STORAGE = os .environ .get ("DEFAULT_FILE_STORAGE" , "django.core.files.storage.FileSystemStorage" )
47- MEDIA_URL = os .environ .get ("MEDIA_URL" , "/media/" )
46+ defaultfile_storage = os .environ .get ("DEFAULT_FILE_STORAGE" )
47+
48+ if defaultfile_storage :
49+ STORAGES ["default" ]["BACKEND" ] = defaultfile_storage
50+
51+ staticfiles_storage = os .environ .get ("STATICFILES_STORAGE" )
4852
49- STATICFILES_STORAGE = os .environ .get ("STATICFILES_STORAGE" , "django.contrib.staticfiles.storage.StaticFilesStorage" )
53+ if staticfiles_storage :
54+ STORAGES ["staticfiles" ]["BACKEND" ] = staticfiles_storage
55+
56+ MEDIA_URL = os .environ .get ("MEDIA_URL" , "/media/" )
5057STATIC_URL = os .environ .get ("STATIC_URL" , "/static/" )
5158
5259# OAuth2 variables specific to social-auth/SSO login use case.
Original file line number Diff line number Diff line change 4444
4545 vars ().update (config_from_yaml )
4646
47+ FILE_STORAGE_BACKEND = config_from_yaml .get ("FILE_STORAGE_BACKEND" , {})
48+ default_backend = FILE_STORAGE_BACKEND .pop ("DEFAULT_FILE_STORAGE" , None )
49+ static_backend = FILE_STORAGE_BACKEND .pop ("STATICFILES_STORAGE" , None )
50+
4751 # Load the files storage backend settings for django storages
52+ # In django==4.2.24 following line sets the DEFAULT_FILE_STORAGE and other AWS variables as per YAML.
4853 vars ().update (FILE_STORAGE_BACKEND )
4954
55+ if default_backend :
56+ STORAGES ["default" ]["BACKEND" ] = default_backend
57+
58+ if static_backend :
59+ STORAGES ["staticfiles" ]["BACKEND" ] = static_backend
60+
5061# make sure this happens after the configuration file overrides so format string can be overridden
5162LOGGING = get_logger_config (format_string = LOGGING_FORMAT_STRING )
5263
Original file line number Diff line number Diff line change 3535
3636# Local Directories
3737TEST_ROOT = path ("test_root" )
38- DEFAULT_FILE_STORAGE = "django.core.files.storage.FileSystemStorage"
38+
3939MEDIA_ROOT = str (TEST_ROOT / "uploads" )
4040MEDIA_URL = "/static/uploads/"
4141
4949 "JWT_AUDIENCE" : SOCIAL_AUTH_EDX_OAUTH2_KEY ,
5050 }
5151)
52- STATICFILES_STORAGE = "django.contrib.staticfiles.storage.StaticFilesStorage"
5352
5453# Verifiable Credentials
5554ENABLE_VERIFIABLE_CREDENTIALS = True
You can’t perform that action at this time.
0 commit comments