Guides / ValueError: Missing staticfiles manifest entry
ValueError: Missing staticfiles manifest entry
A page that worked in development returns a 500 in production, and the log says ValueError: Missing staticfiles manifest entry for 'css/app.css'. Your templates ask for a static file that the manifest, built by collectstatic, doesn't list. Either the manifest is missing or that file isn't in it.
ValueError: Missing staticfiles manifest entry for 'css/app.css'
What it means
With ManifestStaticFilesStorage (and WhiteNoise's CompressedManifestStaticFilesStorage) every static file gets a content hash in its name, such as app.3f2a9c1b.css. The mapping from css/app.css to the hashed name lives in staticfiles.json, written by collectstatic. When DEBUG = False, {% static 'css/app.css' %} looks the name up there and raises if it isn't found.
Why it happens
collectstaticdidn't run (or ran in a different place) before the app started, so there's no manifest.- The file doesn't exist. A typo in the template, a file renamed or deleted, or a path that only works because of
DEBUGfinders. - The file is produced by a front-end build (npm, Vite, Tailwind) that ran after
collectstatic, or not at all on the server. - The file lives outside the static finders. A folder missing from
STATICFILES_DIRS, or an app missing fromINSTALLED_APPS. - The manifest is stale. It was built before the file was added, or you deployed new templates with an older
staticfiles.json. - Tests run with the production storage without a manifest and fail even though the site is fine.
The fix
Run the pieces in the right order, and check the manifest was written:
npm ci && npm run build # if you build front-end assets, do it first
python manage.py collectstatic --noinput
ls staticfiles/staticfiles.json # the manifest, inside your STATIC_ROOT
Then find out whether the file is known to Django at all:
python manage.py findstatic css/app.css
If findstatic says "No matching file found", the file really is missing (typo, not built, or its folder is not in STATICFILES_DIRS). Fix that. If it finds the file but the error continues, collectstatic hasn't run since the file was added.
If the file does exist in STATIC_ROOT but the manifest is stale or incomplete, you can relax the strict lookup so Django computes the hashed name on the fly instead of raising. Use it as a stopgap while you fix the build order. It does not help when the file truly doesn't exist: that still fails with ValueError: The file '...' could not be found.
# storage.py
from whitenoise.storage import CompressedManifestStaticFilesStorage
class ForgivingStorage(CompressedManifestStaticFilesStorage):
manifest_strict = False
# settings.py
STORAGES = {
"default": {"BACKEND": "django.core.files.storage.FileSystemStorage"},
"staticfiles": {"BACKEND": "myproject.storage.ForgivingStorage"},
}
For tests, use the plain storage so you don't need a manifest: set "staticfiles": {"BACKEND": "django.contrib.staticfiles.storage.StaticFilesStorage"} in your test settings.
Making it stick in production
- Make
collectstatica build step that fails the deploy when it errors, and runs after front-end builds. - Keep the build output (
STATIC_ROOT, includingstaticfiles.json) inside the artifact that is deployed, not rebuilt on each instance. - Run a smoke test against the built artifact with
DEBUG = Falsethat fetches your main pages. A missing entry shows up there, not in front of users. - Background and the full static setup: Django static files not loading in production. For other causes of a bare 500: Server Error (500) with DEBUG = False.
Or skip it
Django Cloud runs collectstatic during every build, and if the build fails the previous release keeps serving, so a broken static setup never replaces a working site.
pip install djangocloud-cli
djangocloud deploy
Free plans are available for students, AWS Activate startups, open-source, non-profit and research projects. See how Django Cloud compares with other ways to host Django.
Django is a registered trademark of the Django Software Foundation. Django Cloud is not affiliated with or endorsed by it. Found a mistake in this guide? Tell us and we will fix it.