Changelog
### 4.1
```
----
* Silenced spurious warning about missing directories when in development (i.e
"autorefresh") mode.
* Support supplying paths as `Pathlib
<https://docs.python.org/3.4/library/pathlib.html>`_ instances, rather than
just strings (thanks `browniebroke <https://github.com/browniebroke>`_).
* Add a new :ref:`CompressedStaticFilesStorage <compression-and-caching>`
backend to support applying compression without applying Django's hash-versioning
process.
* Documentation improvements.
```
### 4.0
```
----
.. note:: **Breaking changes**
The latest version of WhiteNoise removes some options which were
deprecated in the previous major release:
* The WSGI integration option for Django
(which involved editing ``wsgi.py``) has been removed. Instead, you
should add WhiteNoise to your
middleware list in ``settings.py`` and remove any reference to WhiteNoise from
``wsgi.py``.
See the :ref:`documentation <django-middleware>` for more details. |br|
(The :doc:`pure WSGI <base>` integration is still available for non-Django apps.)
* The ``whitenoise.django.GzipManifestStaticFilesStorage`` alias has now
been removed. Instead you should use the correct import path:
``whitenoise.storage.CompressedManifestStaticFilesStorage``.
If you are not using either of these integration options you should have
no issues upgrading to the latest version.
Removed Python 3.3 Support
++++++++++++++++++++++++++
Removed support for Python 3.3 since it's end of life was in September 2017.
Index file support
++++++++++++++++++
WhiteNoise now supports serving :ref:`index files <index-files-django>` for
directories (e.g. serving ``/example/index.html`` at ``/example/``). It also
creates redirects so that visiting the index file directly, or visiting the URL
without a trailing slash will redirect to the correct URL.
Range header support ("byte serving")
+++++++++++++++++++++++++++++++++++++
WhiteNoise now respects the HTTP Range header which allows a client to request
only part of a file. The main use for this is in serving video files to iOS
devices as Safari refuses to play videos unless the server supports the
Range header.
ETag support
++++++++++++
WhiteNoise now adds ETag headers to files using the same algorithm used by
nginx. This gives slightly better caching behaviour than relying purely on Last
Modified dates (although not as good as creating immutable files using
something like ``ManifestStaticFilesStorage``, which is still the best option
if you can use it).
If you need to generate your own ETags headers for any reason you can define a
custom :any:`add_headers_function <WHITENOISE_ADD_HEADERS_FUNCTION>`.
Remove requirement to run collectstatic
+++++++++++++++++++++++++++++++++++++++
By setting :any:`WHITENOISE_USE_FINDERS` to ``True`` files will be served
directly from their original locations (usually in ``STATICFILES_DIRS`` or app
``static`` subdirectories) without needing to be collected into ``STATIC_ROOT``
by the collectstatic command. This was
always the default behaviour when in ``DEBUG`` mode but previously it wasn't
possible to enable this behaviour in production. For small apps which aren't
using the caching and compression features of the more advanced storage
backends this simplifies the deployment process by removing the need to run
collectstatic as part of the build step -- in fact, it's now possible not to
have any build step at all.
Customisable immutable files test
+++++++++++++++++++++++++++++++++
WhiteNoise ships with code which detects when you are using Django's
ManifestStaticFilesStorage backend and sends optimal caching headers for files
which are guaranteed not to change. If you are using a different system for
generating cacheable files then you might need to supply your own function for
detecting such files. Previously this required subclassing WhiteNoise, but now
you can use the :any:`WHITENOISE_IMMUTABLE_FILE_TEST` setting.
Fix runserver_nostatic to work with Channels
++++++++++++++++++++++++++++++++++++++++++++
The old implementation of :ref:`runserver_nostatic <runserver-nostatic>` (which
disables Django's default static file handling in development) did not work
with `Channels`_, which needs its own runserver implementation. The
runserver_nostatic command has now been rewritten so that it should work with
Channels and with any other app which provides its own runserver.
.. _Channels: https://channels.readthedocs.io/
Reduced storage requirements for static files
+++++++++++++++++++++++++++++++++++++++++++++
The new :any:`WHITENOISE_KEEP_ONLY_HASHED_FILES` setting reduces the number of
files in STATIC_ROOT by half by storing files only under their hashed names
(e.g. ``app.db8f2edc0c8a.js``), rather than also keeping a copy with the
original name (e.g. ``app.js``).
Improved start up performance
+++++++++++++++++++++++++++++
When in production mode (i.e. when :any:`autorefresh <WHITENOISE_AUTOREFRESH>`
is disabled), WhiteNoise scans all static files when the application starts in
order to be able to serve them as efficiently and securely as possible. For
most applications this makes no noticeable difference to start up time, however
for applications with very large numbers of static files this process can take
some time. In WhiteNoise 4.0 the file scanning code has been rewritten to do
the minimum possible amount of filesystem access which should make the start up
process considerably faster.
Windows Testing
+++++++++++++++
WhiteNoise has always aimed to support Windows as well as \*NIX platforms but
we are now able to run the test suite against Windows as part of the CI process
which should ensure that we can maintain Windows compatibility in future.
Modification times for compressed files
+++++++++++++++++++++++++++++++++++++++
The compressed storage backend (which generates Gzip and Brotli compressed
files) now ensures that compressed files have the same modification time as the
originals. This only makes a difference if you are using the compression
backend with something other than WhiteNoise to actually serve the files, which
very few users do.
Replaced brotlipy with official Brotli Python Package
+++++++++++++++++++++++++++++++++++++++++++++++++++++
Since the official `Brotli project <https://github.com/google/brotli>`_ offers
a `Brotli Python package <https://pypi.org/project/Brotli/>`_ brotlipy has been
replaced with Brotli.
Furthermore a ``brotli`` key has been added to ``extras_require`` which allows
installing WhiteNoise and Brotli together like this:
.. code-block:: bash
pip install whitenoise[brotli]
---------------------------
```
Links
- PyPI: https://pypi.org/project/whitenoise
- Changelog: https://pyup.io/changelogs/whitenoise/
- Homepage: http://whitenoise.evans.io
This PR updates whitenoise from 3.3.1 to 4.1.
Changelog
### 4.1 ``` ---- * Silenced spurious warning about missing directories when in development (i.e "autorefresh") mode. * Support supplying paths as `Pathlib <https://docs.python.org/3.4/library/pathlib.html>`_ instances, rather than just strings (thanks `browniebroke <https://github.com/browniebroke>`_). * Add a new :ref:`CompressedStaticFilesStorage <compression-and-caching>` backend to support applying compression without applying Django's hash-versioning process. * Documentation improvements. ``` ### 4.0 ``` ---- .. note:: **Breaking changes** The latest version of WhiteNoise removes some options which were deprecated in the previous major release: * The WSGI integration option for Django (which involved editing ``wsgi.py``) has been removed. Instead, you should add WhiteNoise to your middleware list in ``settings.py`` and remove any reference to WhiteNoise from ``wsgi.py``. See the :ref:`documentation <django-middleware>` for more details. |br| (The :doc:`pure WSGI <base>` integration is still available for non-Django apps.) * The ``whitenoise.django.GzipManifestStaticFilesStorage`` alias has now been removed. Instead you should use the correct import path: ``whitenoise.storage.CompressedManifestStaticFilesStorage``. If you are not using either of these integration options you should have no issues upgrading to the latest version. Removed Python 3.3 Support ++++++++++++++++++++++++++ Removed support for Python 3.3 since it's end of life was in September 2017. Index file support ++++++++++++++++++ WhiteNoise now supports serving :ref:`index files <index-files-django>` for directories (e.g. serving ``/example/index.html`` at ``/example/``). It also creates redirects so that visiting the index file directly, or visiting the URL without a trailing slash will redirect to the correct URL. Range header support ("byte serving") +++++++++++++++++++++++++++++++++++++ WhiteNoise now respects the HTTP Range header which allows a client to request only part of a file. The main use for this is in serving video files to iOS devices as Safari refuses to play videos unless the server supports the Range header. ETag support ++++++++++++ WhiteNoise now adds ETag headers to files using the same algorithm used by nginx. This gives slightly better caching behaviour than relying purely on Last Modified dates (although not as good as creating immutable files using something like ``ManifestStaticFilesStorage``, which is still the best option if you can use it). If you need to generate your own ETags headers for any reason you can define a custom :any:`add_headers_function <WHITENOISE_ADD_HEADERS_FUNCTION>`. Remove requirement to run collectstatic +++++++++++++++++++++++++++++++++++++++ By setting :any:`WHITENOISE_USE_FINDERS` to ``True`` files will be served directly from their original locations (usually in ``STATICFILES_DIRS`` or app ``static`` subdirectories) without needing to be collected into ``STATIC_ROOT`` by the collectstatic command. This was always the default behaviour when in ``DEBUG`` mode but previously it wasn't possible to enable this behaviour in production. For small apps which aren't using the caching and compression features of the more advanced storage backends this simplifies the deployment process by removing the need to run collectstatic as part of the build step -- in fact, it's now possible not to have any build step at all. Customisable immutable files test +++++++++++++++++++++++++++++++++ WhiteNoise ships with code which detects when you are using Django's ManifestStaticFilesStorage backend and sends optimal caching headers for files which are guaranteed not to change. If you are using a different system for generating cacheable files then you might need to supply your own function for detecting such files. Previously this required subclassing WhiteNoise, but now you can use the :any:`WHITENOISE_IMMUTABLE_FILE_TEST` setting. Fix runserver_nostatic to work with Channels ++++++++++++++++++++++++++++++++++++++++++++ The old implementation of :ref:`runserver_nostatic <runserver-nostatic>` (which disables Django's default static file handling in development) did not work with `Channels`_, which needs its own runserver implementation. The runserver_nostatic command has now been rewritten so that it should work with Channels and with any other app which provides its own runserver. .. _Channels: https://channels.readthedocs.io/ Reduced storage requirements for static files +++++++++++++++++++++++++++++++++++++++++++++ The new :any:`WHITENOISE_KEEP_ONLY_HASHED_FILES` setting reduces the number of files in STATIC_ROOT by half by storing files only under their hashed names (e.g. ``app.db8f2edc0c8a.js``), rather than also keeping a copy with the original name (e.g. ``app.js``). Improved start up performance +++++++++++++++++++++++++++++ When in production mode (i.e. when :any:`autorefresh <WHITENOISE_AUTOREFRESH>` is disabled), WhiteNoise scans all static files when the application starts in order to be able to serve them as efficiently and securely as possible. For most applications this makes no noticeable difference to start up time, however for applications with very large numbers of static files this process can take some time. In WhiteNoise 4.0 the file scanning code has been rewritten to do the minimum possible amount of filesystem access which should make the start up process considerably faster. Windows Testing +++++++++++++++ WhiteNoise has always aimed to support Windows as well as \*NIX platforms but we are now able to run the test suite against Windows as part of the CI process which should ensure that we can maintain Windows compatibility in future. Modification times for compressed files +++++++++++++++++++++++++++++++++++++++ The compressed storage backend (which generates Gzip and Brotli compressed files) now ensures that compressed files have the same modification time as the originals. This only makes a difference if you are using the compression backend with something other than WhiteNoise to actually serve the files, which very few users do. Replaced brotlipy with official Brotli Python Package +++++++++++++++++++++++++++++++++++++++++++++++++++++ Since the official `Brotli project <https://github.com/google/brotli>`_ offers a `Brotli Python package <https://pypi.org/project/Brotli/>`_ brotlipy has been replaced with Brotli. Furthermore a ``brotli`` key has been added to ``extras_require`` which allows installing WhiteNoise and Brotli together like this: .. code-block:: bash pip install whitenoise[brotli] --------------------------- ```Links
- PyPI: https://pypi.org/project/whitenoise - Changelog: https://pyup.io/changelogs/whitenoise/ - Homepage: http://whitenoise.evans.io