From 221c8c19c2f9b4b882a6b5fc7721778d9c859ea5 Mon Sep 17 00:00:00 2001 From: codex_a Date: Sun, 1 Mar 2026 11:47:18 +0000 Subject: [PATCH] fix: migrate STATICFILES_STORAGE to STORAGES for Django 5.2 compat Django 5.1+ removes STATICFILES_STORAGE in favour of the STORAGES dict. The old setting was silently ignored on Django 5.2, causing StaticFilesStorage (the default) to be used instead of CompressedManifestStaticFilesStorage. Result: no content-hashed filenames, no staticfiles.json manifest, and Cloudflare caching /static/css/styles.css indefinitely with no cache busting on deploy. Fix: use STORAGES in base.py (CompressedManifestStaticFilesStorage) and development.py (plain StaticFilesStorage, whitenoise disabled in dev). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- config/settings/base.py | 9 ++++++++- config/settings/development.py | 10 +++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/config/settings/base.py b/config/settings/base.py index 89c2c16..fee1614 100644 --- a/config/settings/base.py +++ b/config/settings/base.py @@ -142,6 +142,13 @@ X_CONTENT_TYPE_OPTIONS = "nosniff" CSRF_TRUSTED_ORIGINS = [u for u in os.getenv("CSRF_TRUSTED_ORIGINS", "http://localhost:8035").split(",") if u] TRUSTED_PROXY_IPS = [ip.strip() for ip in os.getenv("TRUSTED_PROXY_IPS", "").split(",") if ip.strip()] -STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage" +STORAGES = { + "default": { + "BACKEND": "django.core.files.storage.FileSystemStorage", + }, + "staticfiles": { + "BACKEND": "whitenoise.storage.CompressedManifestStaticFilesStorage", + }, +} TAILWIND_APP_NAME = "theme" diff --git a/config/settings/development.py b/config/settings/development.py index fd19e5d..1468b9f 100644 --- a/config/settings/development.py +++ b/config/settings/development.py @@ -9,7 +9,15 @@ INTERNAL_IPS = ["127.0.0.1"] # media files natively when DEBUG=True (via django.contrib.staticfiles + the # media URL pattern in urls.py). MIDDLEWARE = [m for m in MIDDLEWARE if m != "whitenoise.middleware.WhiteNoiseMiddleware"] -STATICFILES_STORAGE = "django.contrib.staticfiles.storage.StaticFilesStorage" +STORAGES = { + "default": { + "BACKEND": "django.core.files.storage.FileSystemStorage", + }, + "staticfiles": { + "BACKEND": "django.contrib.staticfiles.storage.StaticFilesStorage", + }, +} + try: import debug_toolbar # noqa: F401 -- 2.49.1