HelloWebApp needs updating - WhiteNoise


#1

Hey @limedaring.

Your book is much appreciated and I enjoyed the first 14 chapters until I tried to deploy to Heroku. I spent a painful 60 minutes trying to understand which part in the book I got wrong, but eventually I figured out that the problem is outdated code. WhiteNoise does not work like you describe it in the book anymore.

A reader that follows the book closely will get this error when pushing to Heroku:

ImportError:
remote: Your WhiteNoise configuration is incompatible with WhiteNoise v4.0
remote: This can be fixed by following the upgrade instructions at:
remote: http://whitenoise.evans.io/en/stable/changelog.html#v4-0

The changes a reader needs to make:

  • remove any mention of WhiteNoise in the wsgi.py file
  • add “‘whitenoise.middleware.WhiteNoiseMiddleware’,” right below “‘django.middleware.security.SecurityMiddleware’,” in the Middleware section in settings.py
  • replace “STATICFILES_STORAGE = ‘whitenoise.django.GzipManifestStaticFilesStorage’” with “STATICFILES_STORAGE = ‘whitenoise.storage.CompressedManifestStaticFilesStorage’” in settings_production.py

See here for more info on how to fix it: http://whitenoise.evans.io/en/stable/changelog.html#v4-0


#2

Arg, thank you! Things keep updating on me. I’ll release an update this week. Appreciate you tracking this down and letting me know!


#3

FYI I’ve updated the hellowebapp-deploy package to install the specific version of whitenoise before the breaking changes: https://pypi.org/project/hellowebapp-deploy/

If anyone would like to reinstall to get the correct version number, use this (which’ll also prevent install off the old/cached version):
pip install hellowebapp-deploy --no-cache-dir

Thanks again to @Alex for letting me know about this issue.

Re: updating HWA, I’m still looking into what would be the best way to announce bugs or updates based on external package updates on the hellowebbooks.com website, I’ll have an announcement of sorts about that soon. 👍