From 2862242649772aa35fd5a32e70c000d1a883edbd Mon Sep 17 00:00:00 2001 From: Raphael Odini Date: Tue, 27 Aug 2024 16:41:13 +0200 Subject: [PATCH] Fix config for staticfiles --- config/settings/base.py | 5 ++++- config/settings/prod.py | 3 ++- config/settings/staging.py | 3 ++- config/settings/test.py | 4 +++- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/config/settings/base.py b/config/settings/base.py index b0c83d67c..5382a0c72 100644 --- a/config/settings/base.py +++ b/config/settings/base.py @@ -64,7 +64,10 @@ "compressor.finders.CompressorFinder", ] -STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage" +STORAGES = { + "default": {"BACKEND": "django.core.files.storage.FileSystemStorage"}, # default + "staticfiles": {"BACKEND": "whitenoise.storage.CompressedManifestStaticFilesStorage"}, +} STATICFILES_FINDERS += ["compressor.finders.CompressorFinder"] diff --git a/config/settings/prod.py b/config/settings/prod.py index 3d1b9f0ed..f2b277045 100644 --- a/config/settings/prod.py +++ b/config/settings/prod.py @@ -22,7 +22,8 @@ MEDIA_URL = f"https://{S3_STORAGE_ENDPOINT_DOMAIN}/" # noqa -STORAGES = {"default": {"BACKEND": "storages.backends.s3.S3Storage"}} +# flake8: noqa F405 +STORAGES |= {"default": {"BACKEND": "storages.backends.s3.S3Storage"}} # Sentry diff --git a/config/settings/staging.py b/config/settings/staging.py index 2b7d2e9c1..679f154f2 100644 --- a/config/settings/staging.py +++ b/config/settings/staging.py @@ -25,7 +25,8 @@ MEDIA_URL = f"https://{S3_STORAGE_ENDPOINT_DOMAIN}/" # noqa -STORAGES = {"default": {"BACKEND": "storages.backends.s3.S3Storage"}} +# flake8: noqa F405 +STORAGES |= {"default": {"BACKEND": "storages.backends.s3.S3Storage"}} # Sentry diff --git a/config/settings/test.py b/config/settings/test.py index ef69c2bbf..b18c9168a 100644 --- a/config/settings/test.py +++ b/config/settings/test.py @@ -9,7 +9,9 @@ logging.disable(logging.CRITICAL) # `ManifestStaticFilesStorage` (used in base settings) requires `collectstatic` to be run. -STATICFILES_STORAGE = "django.contrib.staticfiles.storage.StaticFilesStorage" +# flake8: noqa F405 +STORAGES |= {"staticfiles": {"BACKEND": "django.contrib.staticfiles.storage.StaticFilesStorage"}} + COMPRESS_OFFLINE = False EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"