Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Adjust settings for removed DEFAULT_FILE_STORAGE and STATICFILES_STORAGE variables (#17781)

Krzysztof Waliczekcf60b4d76d17
diff --git a/saleor/settings.py b/saleor/settings.py
index 4711cc3906..e4197881a9 100644
--- a/saleor/settings.py
+++ b/saleor/settings.py
@@ -522,17 +522,23 @@ AZURE_CONTAINER = os.environ.get("AZURE_CONTAINER")
AZURE_CONTAINER_PRIVATE = os.environ.get("AZURE_CONTAINER_PRIVATE")
AZURE_SSL = os.environ.get("AZURE_SSL")
+# Replicate behavior of creating default values
+STORAGES = {
+ "default": {"BACKEND": "django.core.files.storage.FileSystemStorage"},
+ "staticfiles": {"BACKEND": "django.contrib.staticfiles.storage.StaticFilesStorage"},
+}
+
if AWS_STORAGE_BUCKET_NAME:
- STATICFILES_STORAGE = "storages.backends.s3boto3.S3Boto3Storage"
+ STORAGES["staticfiles"] = {"BACKEND": "storages.backends.s3boto3.S3Boto3Storage"}
elif GS_BUCKET_NAME:
- STATICFILES_STORAGE = "storages.backends.gcloud.GoogleCloudStorage"
+ STORAGES["staticfiles"] = {"BACKEND": "storages.backends.gcloud.GoogleCloudStorage"}
if AWS_MEDIA_BUCKET_NAME:
- DEFAULT_FILE_STORAGE = "saleor.core.storages.S3MediaStorage"
+ STORAGES["default"] = {"BACKEND": "saleor.core.storages.S3MediaStorage"}
elif GS_MEDIA_BUCKET_NAME:
- DEFAULT_FILE_STORAGE = "saleor.core.storages.GCSMediaStorage"
+ STORAGES["default"] = {"BACKEND": "saleor.core.storages.GCSMediaStorage"}
elif AZURE_CONTAINER:
- DEFAULT_FILE_STORAGE = "saleor.core.storages.AzureMediaStorage"
+ STORAGES["default"] = {"BACKEND": "saleor.core.storages.AzureMediaStorage"}
PRIVATE_FILE_STORAGE = "django.core.files.storage.FileSystemStorage"
if AWS_MEDIA_PRIVATE_BUCKET_NAME: