Skip to content

Commit

Permalink
Add whitenoise for static files storage in production
Browse files Browse the repository at this point in the history
  • Loading branch information
ahosgood committed Sep 17, 2024
1 parent 3733f4d commit 667da90
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@
"django.contrib.messages.middleware.MessageMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware",
"django.middleware.security.SecurityMiddleware",
"whitenoise.middleware.WhiteNoiseMiddleware",
"etna.core.middleware.MaintenanceModeMiddleware",
"wagtail.contrib.redirects.middleware.RedirectMiddleware",
"etna.core.middleware.InterpretCookiesMiddleware",
Expand Down
2 changes: 2 additions & 0 deletions config/settings/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,7 @@

SECRET_KEY = os.getenv("SECRET_KEY", "")

STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage"

# TODO: Remove later
ALLOWED_HOSTS = os.environ.get("ALLOWED_HOSTS", "*").split(",")
16 changes: 15 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ wagtail-generic-chooser = "~0.6"
wagtailmedia = "~0.15"
wagtail-metadata = "~5.0"
wagtail-headless-preview = "0.8.0"
whitenoise = "^6.7.0"

[tool.poetry.dev-dependencies]
black = "~24.4"
Expand Down

0 comments on commit 667da90

Please sign in to comment.