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!
Using WhiteNoise in development You can disable Django's static file handling and allow WhiteNoise to take over simply by passing the --nostatic option to the runserver command, but you need to remember to add this option every time you call runserver . An easier way is to edit your settings.py file and add whitenoise.
Radically simplified static file serving for Python web appsWith a couple of lines of config WhiteNoise allows your web app to serve its own static files, making it a self-contained unit that can be deployed anywhere without relying on nginx, Amazon S3 or any other external service.
whitenoise.django.GzipManifestStaticFilesStorage
alias has now been removed. Instead you should use the correct import path:
whitenoise.storage.CompressedManifestStaticFilesStorage
Source Link
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With