Commit 5ec6d70
authored
Improve WhiteNoise configuration (#199)
* 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.html1 parent 4465fc2 commit 5ec6d70
2 files changed
+18
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
| 48 | + | |
47 | 49 | | |
48 | 50 | | |
49 | 51 | | |
| |||
57 | 59 | | |
58 | 60 | | |
59 | 61 | | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
60 | 66 | | |
61 | 67 | | |
62 | 68 | | |
| |||
148 | 154 | | |
149 | 155 | | |
150 | 156 | | |
151 | | - | |
152 | | - | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
153 | 168 | | |
154 | 169 | | |
155 | 170 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
0 commit comments