Skip to content

Conversation

@edmorley
Copy link
Member

@edmorley edmorley commented May 19, 2023

  • Switch from the deprecated STATICFILES_STORAGE Django config option to STORAGES
  • Add whitenoise.runserver_nostatic to INSTALLED_APPS so that WhiteNoise's runserver implementation is used instead of Django's default implementation, for improved dev-prod parity
  • Enable WHITENOISE_KEEP_ONLY_HASHED_FILES, which means the original (un-hashed filename) copy of static assets are no longer unnecessarily stored in the slug. (This does mean all Django templates must use the static processor for asset URLs, but all of the templates in this guide do that already.)
  • Use the brotli WhiteNoise package extra, so that the Brotli package ends up being installed, so that static assets can also be served using the more efficient Brotli compression (for browsers that support it, which is all modern browsers), and not just GZip.

See:
https://whitenoise.readthedocs.io/en/latest/django.html

GUS-W-13323144.

* Switch from the deprecated `STATICFILES_STORAGE` Django config
   option to `STORAGES`
* Add `whitenoise.runserver_nostatic` to `INSTALLED_APPS` so that
   WhiteNoise's runserver implementation is used instead of Django's
   default implementation, for improved dev-prod parity
* Enable `WHITENOISE_KEEP_ONLY_HASHED_FILES`, which means the
   original (un-hashed filename) copy of static assets are no longer
   unnecessarily stored in the slug. (This does mean all Django templates
   must use the `static` processor for asset URLs, but all of the templates
   in this guide do that already.)
* Use the `brotli` WhiteNoise package extra, so that the Brotli package
   ends up being installed, so that static assets can also be served using
   the more efficient Brotli compression (for browsers that support it, which
   is all modern browsers), and not just GZip.

See:
https://whitenoise.readthedocs.io/en/latest/django.html
@edmorley edmorley self-assigned this May 19, 2023
@edmorley edmorley enabled auto-merge (squash) May 19, 2023 15:57
@edmorley edmorley merged commit 5ec6d70 into main May 19, 2023
@edmorley edmorley deleted the edmorley/whitenoise-cleanup branch May 19, 2023 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant