diff --git a/config/settings/base.py b/config/settings/base.py index 2bb363d52..d4dd5a13c 100644 --- a/config/settings/base.py +++ b/config/settings/base.py @@ -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", diff --git a/config/settings/production.py b/config/settings/production.py index 8d9423b06..719311cda 100644 --- a/config/settings/production.py +++ b/config/settings/production.py @@ -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(",") diff --git a/poetry.lock b/poetry.lock index 54b3c7010..75796b964 100644 --- a/poetry.lock +++ b/poetry.lock @@ -2332,6 +2332,20 @@ files = [ {file = "wcwidth-0.2.13.tar.gz", hash = "sha256:72ea0c06399eb286d978fdedb6923a9eb47e1c486ce63e9b4e64fc18303972b5"}, ] +[[package]] +name = "whitenoise" +version = "6.7.0" +description = "Radically simplified static file serving for WSGI applications" +optional = false +python-versions = ">=3.8" +files = [ + {file = "whitenoise-6.7.0-py3-none-any.whl", hash = "sha256:a1ae85e01fdc9815d12fa33f17765bc132ed2c54fa76daf9e39e879dd93566f6"}, + {file = "whitenoise-6.7.0.tar.gz", hash = "sha256:58c7a6cd811e275a6c91af22e96e87da0b1109e9a53bb7464116ef4c963bf636"}, +] + +[package.extras] +brotli = ["brotli"] + [[package]] name = "willow" version = "1.8.0" @@ -2361,4 +2375,4 @@ wand = ["Wand (>=0.6,<1.0)"] [metadata] lock-version = "2.0" python-versions = "^3.11" -content-hash = "c852edc66fb8e3808a1708af806adb9486695e21736037f4de619664aa08c923" +content-hash = "11ff8c1f157ef680d2f46e6940a3bb3d433190abd277e63b213e35840eb09b73" diff --git a/pyproject.toml b/pyproject.toml index 99fe9a865..3ac9ba5f8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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"