Skip to content
Advertisement

Django WhiteNoise configuration is incompatible with WhiteNoise v4.0

I am trying to deploy my Django webapp on Heroku. I have been facing this same error everytime I try to deploy.

ImportError: Your WhiteNoise configuration is incompatible with WhiteNoise v4.0 This can be fixed by following the upgrade instructions at: http://whitenoise.evans.io/en/stable/changelog.html#v4-0 ! Error while running ‘$ python manage.py collectstatic –noinput’. See traceback above for details. You may need to update application code to resolve this error. Or, you can disable collectstatic for this application: $ heroku config:set DISABLE_COLLECTSTATIC=1 https://devcenter.heroku.com/articles/django-assets ! Push rejected, failed to compile Python app. ! Push failed

I visited the link to make the changes as the documentation suggests. It required me to remove any mention from the the wsgi.py file and I had to add it to the middleware in settings.py and change the static storage.

#settings.py
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware',
.
.
.
.
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'

I am following this tutorial (https://simpleisbetterthancomplex.com/tutorial/2016/08/09/how-to-deploy-django-applications-on-heroku.html)

I’m not sure what is causing this error. Whitenoise updates are applied and the static files are in place as well.

The project works like a charm on local server but im just not able to deploy it. Thanks in advance!

Advertisement

Answer

whitenoise.django.GzipManifestStaticFilesStorage

alias has now been removed. Instead you should use the correct import path:

whitenoise.storage.CompressedManifestStaticFilesStorage

Source Link

Advertisement