ValueError: Missing staticfiles manifest entry for 'favicon.ico'
Try running:
python manage.py collectstatic
Does the test work now? If so, this might be the configuration causing a problem:
STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage'
as of whitenoise v4 this will fail and you should use:
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
Related:
https://stackoverflow.com/a/32347324/2596187
Check out the Django documentation: https://docs.djangoproject.com/en/1.11/ref/contrib/staticfiles/#django.contrib.staticfiles.storage.ManifestStaticFilesStorage.manifest_strict
If you want to continue to use the WhiteNoise module in your Django 1.11 (or newer) project while preventing this "Missing staticfiles manifest entry" error, you need to disable the manifest_strict
attribute by means of inheritance, as noted in Django documentation.
How to accomplish that?
Firstly, create a storage.py
file in your project directory:
from whitenoise.storage import CompressedManifestStaticFilesStorage
class WhiteNoiseStaticFilesStorage(CompressedManifestStaticFilesStorage):
manifest_strict = False
Secondly, edit the STATICFILES_STORAGE
constant in your settings.py
file to point to this new class, such as:
STATICFILES_STORAGE = 'my_project.storage.WhiteNoiseStaticFilesStorage'
Just sharing the solution I had to this issue in case it helps anyone else.
I was accidentally including the leading "/" in some static URLs which caused them to be missing from the manifest.
The solution was to replace all instances of:
{% static '/path/to/some/file' %}
with
{% static 'path/to/some/file' %}
and then everything worked properly.