Announcing WhiteNoise 6
WhiteNoise is a simple solution to serving static assets. It lets you skip configuring a separate web server for your static assets, and serve them straight from Django. It’s a brilliant tool. I’ve used it for years on various projects, and I’ve recommended it many times, and mentioned it in several blog posts.
WhiteNoise was created by Dave Evans in 2013. I’ve met Dave several times at the London Django Meetup. Recently the project’s maintenance was getting a bit backlogged, so I volunteered to help and Dave accepted :)
I got to work adding support for modern Python and Django versions, dropping old ones, and merging in a few feature requests. I just released these accumulated changes as version 6.0.0.
Nothing drastic has changed for the major version bump - most users should not be affected. setuptools’s python_requires
field also ensures users on outdated Python versions still install older WhiteNoise versions. But there are enough changes that it felt like a major number was needed, and version numbers are cheap.
Here are the changelog entries for 6.0.0:
Drop support for Python 3.5 and 3.6.
Add support for Python 3.9 and 3.10.
Drop support for Django 1.11, 2.0, and 2.1.
Add support for Django 4.0.
Import new MIME types from Nginx, changes:
.avif
files are now served with theimage/avif
MIME type.- Open Document files with extensions
.odg
,.odp
,.ods
, and.odt
are now served with their respectiveapplication/vnd.oasis.opendocument.*
MIME types.
The
whitenoise.__version__
attribute has been removed. Useimportlib.metadata.version()
to check the version of Whitenoise if you need to.Requests using the
Range
header can no longer read beyond the end of the requested range.Thanks to Richard Tibbles in PR #322.
Treat empty and
"*"
values forAccept-Encoding
as if the client doesn’t support any encoding.Thanks to Richard Tibbles in PR #323.
Thanks very much to Richard Tibbles and Paolo Melchiorre for contributions towards this release. And thanks to Dave Evans for creating such a useful package.
There are still some open issues and PRs I hope to look at - including an ASGI adapter. Exciting.
Upgrade and let me know if you have any problems!
—Adam
Learn how to make your tests run quickly in my book Speed Up Your Django Tests.
One summary email a week, no spam, I pinky promise.
Related posts:
Tags: django