fix: migrate STATICFILES_STORAGE to STORAGES (Django 5.2) #21

Merged
mark merged 1 commits from fix/storages-django52 into main 2026-03-01 11:51:04 +00:00
Owner

Root cause of unstyled production site

Django 5.1 removed the STATICFILES_STORAGE setting in favour of the STORAGES dict. On Django 5.2, the old setting was silently ignored, causing Django to fall back to the default StaticFilesStorage instead of CompressedManifestStaticFilesStorage.

Effects:

  • No content-hashed filenames generated (no styles.abc123.css)
  • No staticfiles.json manifest written
  • {% static %} tag returns plain /static/css/styles.css with no cache busting
  • Cloudflare caches /static/css/styles.css with a 4-hour TTL — old CSS served to users after deploy until cache expires

Fix: Replace STATICFILES_STORAGE with STORAGES dict in both base.py and development.py.

After this merges and deploys, collectstatic will create hashed filenames (styles.{hash}.css), write staticfiles.json, and {% static %} will return versioned URLs that Cloudflare caches indefinitely with automatic cache busting on content change.

## Root cause of unstyled production site Django 5.1 removed the `STATICFILES_STORAGE` setting in favour of the `STORAGES` dict. On Django 5.2, the old setting was **silently ignored**, causing Django to fall back to the default `StaticFilesStorage` instead of `CompressedManifestStaticFilesStorage`. **Effects:** - No content-hashed filenames generated (no `styles.abc123.css`) - No `staticfiles.json` manifest written - `{% static %}` tag returns plain `/static/css/styles.css` with no cache busting - Cloudflare caches `/static/css/styles.css` with a 4-hour TTL — old CSS served to users after deploy until cache expires **Fix:** Replace `STATICFILES_STORAGE` with `STORAGES` dict in both `base.py` and `development.py`. After this merges and deploys, `collectstatic` will create hashed filenames (`styles.{hash}.css`), write `staticfiles.json`, and `{% static %}` will return versioned URLs that Cloudflare caches indefinitely with automatic cache busting on content change.
codex_a added 1 commit 2026-03-01 11:47:50 +00:00
fix: migrate STATICFILES_STORAGE to STORAGES for Django 5.2 compat
All checks were successful
CI / nightly-e2e (pull_request) Has been skipped
CI / deploy (pull_request) Has been skipped
CI / pr-e2e (pull_request) Successful in 1m6s
CI / ci (pull_request) Successful in 1m25s
221c8c19c2
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>
mark merged commit d83f7db57c into main 2026-03-01 11:51:04 +00:00
mark deleted branch fix/storages-django52 2026-03-01 11:51:05 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: nohype/main-site#21