----------------
.. note:: The latest version of WhiteNoise contains some small **breaking changes**.
Most users will be able to upgrade without any problems, but some
less-used APIs have been modified:
* The setting ``WHITENOISE_GZIP_EXCLUDE_EXTENSIONS`` has been renamed to
``WHITENOISE_SKIP_COMPRESS_EXTENSIONS``.
* The CLI :ref:`compression utility <cli-utility>` has moved from ``python -m whitenoise.gzip``
to ``python -m whitenoise.compress``.
* The now redundant ``gzipstatic`` management command has been removed.
* WhiteNoise no longer uses the system mimetypes files, so if you are serving
particularly obscure filetypes you may need to add their mimetypes explicitly
using the new :any:`mimetypes <WHITENOISE_MIMETYPES>` setting.
* Older versions of Django (1.4-1.7) and Python (2.6) are no longer supported.
If you need support for these platforms you can continue to use `WhiteNoise
2.x`_.
* The ``whitenoise.django.GzipManifestStaticFilesStorage`` storage backend
has been moved to
``whitenoise.storage.CompressedManifestStaticFilesStorage``. The old
import path **will continue to work** for now, but users are encouraged
to update their code to use the new path.
.. _WhiteNoise 2.x: https://whitenoise.readthedocs.io/en/legacy-2.x/
.. rubric:: Simpler, cleaner Django middleware integration
WhiteNoise can now integrate with Django by adding a single line to
``MIDDLEWARE_CLASSES`` without any need to edit ``wsgi.py``. This also means
that WhiteNoise plays nicely with other middleware classes such as
*SecurityMiddleware*, and that it is fully compatible with the new `Channels`_
system. See the :ref:`updated documentation <django-middleware>` for details.
.. _Channels: https://channels.readthedocs.io/
.. rubric:: Brotli compression support
`Brotli`_ is the modern, more efficient alternative to gzip for HTTP
compression. To benefit from smaller files and faster page loads, just install
the `brotlipy`_ library, update your ``requirements.txt`` and WhiteNoise
will take care of the rest. See the :ref:`documentation <brotli-compression>`
for details.
.. _brotli: https://en.wikipedia.org/wiki/Brotli
.. _brotlipy: https://brotlipy.readthedocs.io/
.. rubric:: Simpler customisation
It's now possible to add custom headers to WhiteNoise without needing to create
a subclass, using the new :any:`add_headers_function
<WHITENOISE_ADD_HEADERS_FUNCTION>` setting.
.. rubric:: Use WhiteNoise in development with Django
There's now an option to force Django to use WhiteNoise in development, rather
than its own static file handling. This results in more consistent behaviour
between development and production environments and fewer opportunities for
bugs and surprises. See the :ref:`documentation <runserver-nostatic>` for
details.
.. rubric:: Improved mimetype handling
WhiteNoise now ships with its own mimetype definitions (based on those shipped
with nginx) instead of relying on the system ones, which can vary between
environments. There is a new :any:`mimetypes <WHITENOISE_MIMETYPES>`
configuration option which makes it easy to add additional type definitions if
needed.
.. rubric:: Thanks
A big thank-you to `Ed Morley <https://github.com/edmorley>`_ and `Tim Graham <https://github.com/timgraham>`_ for their contributions to this release.