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>
29 lines
835 B
Python
29 lines
835 B
Python
from .base import * # noqa
|
|
|
|
DEBUG = True
|
|
|
|
INTERNAL_IPS = ["127.0.0.1"]
|
|
|
|
# Drop WhiteNoise in dev — it serves from STATIC_ROOT which is empty without
|
|
# collectstatic, so it 404s every asset. Django's runserver serves static and
|
|
# 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"]
|
|
STORAGES = {
|
|
"default": {
|
|
"BACKEND": "django.core.files.storage.FileSystemStorage",
|
|
},
|
|
"staticfiles": {
|
|
"BACKEND": "django.contrib.staticfiles.storage.StaticFilesStorage",
|
|
},
|
|
}
|
|
|
|
|
|
try:
|
|
import debug_toolbar # noqa: F401
|
|
|
|
INSTALLED_APPS += ["debug_toolbar"]
|
|
MIDDLEWARE = ["debug_toolbar.middleware.DebugToolbarMiddleware", *MIDDLEWARE]
|
|
except Exception:
|
|
pass
|