I\'m trying to serve static files through WhiteNoise as per Heroku\'s recommendation. When I run collectstatic
in my development environment, this happens:
The problem here is that css/iconic/open-iconic-bootstrap.css
is referencing a file, open-iconic.eot
, which doesn't exist in the expected location.
When you run collectstatic
with that storage backend Django attempts to rewrite all the URLs in your CSS files so they reference the files by their new names e.g, css/iconic/open-iconic.8a7442ca6bed.eot
. If it can't find the file it stops with that error.
The issue here is that using
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
or
STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.ManifestStaticFilesStorage
uses Django's static file storage in a different way than runserver does. See the Django docs for some explanation: https://docs.djangoproject.com/en/1.11/ref/contrib/staticfiles/#django.contrib.staticfiles.storage.ManifestStaticFilesStorage.manifest_strict
I believe the referenced manifest gets built when you run collectstatic, so doing so should fix this problem temporarily, but you likely don't want to run collectstatic before every test run if you have modified any static files. Another solution would be to disable this setting for your tests, and just run it in production.