From 5a258a30f013fd1ebd96799a57525139558661fe Mon Sep 17 00:00:00 2001 From: "madjid.asa" Date: Fri, 20 Sep 2024 14:08:23 +0200 Subject: [PATCH] fix: s3 storage fix in prod --- config/settings/prod.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/config/settings/prod.py b/config/settings/prod.py index 1fd992357..9e7170e5c 100644 --- a/config/settings/prod.py +++ b/config/settings/prod.py @@ -21,7 +21,24 @@ SECURE_SSL_REDIRECT = env.str("SECURE_SSL_REDIRECT", True) MEDIA_URL = f"https://{S3_STORAGE_ENDPOINT_DOMAIN}/" # noqa -DEFAULT_FILE_STORAGE = "lemarche.utils.s3boto.S3BotoStorage" + +STORAGES = { + "default": { + "BACKEND": "storages.backends.s3.S3Storage", + "OPTIONS": { + "bucket_name": S3_STORAGE_BUCKET_NAME, # noqa + "access_key": S3_STORAGE_ACCESS_KEY_ID, # noqa + "secret_key": S3_STORAGE_SECRET_ACCESS_KEY, # noqa + "endpoint_url": f"https://{S3_STORAGE_ENDPOINT_DOMAIN}", # noqa + "region_name": S3_STORAGE_BUCKET_REGION, # noqa + "file_overwrite": False, + "location": env.str("S3_LOCATION", ""), + }, + }, + "staticfiles": { + "BACKEND": "django.contrib.staticfiles.storage.StaticFilesStorage", + }, +} # Sentry