Skip to content

Commit

Permalink
Fix config for staticfiles
Browse files Browse the repository at this point in the history
  • Loading branch information
raphodn committed Aug 27, 2024
1 parent ff84930 commit 2862242
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
5 changes: 4 additions & 1 deletion config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

Expand Down
3 changes: 2 additions & 1 deletion config/settings/prod.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion config/settings/staging.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion config/settings/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 2862242

Please sign in to comment.