Django middleware that compresses response using brotli algorithm.
This project consists of BrotliMiddleware
which works the same as Django GZipMiddleware
(Docs/Source). BrotliMiddleware
will compress content of HTTP response using brotli algorithm (Brotli Compressed Data Format is defined in RFC 7932).
In November 2016 is brotli supported by Firefox, Chrome, Android Browser and Opera (detailed stats on caniuse). Brotli is applied only when client has sent Accept-Encoding
header containing br
.
">=3.10, <3.14"
.>=4,<6
.
poetry add django-brotli@latest
or
pip install --upgrade django-brotli
Add django_brotli.middleware.BrotliMiddleware
to MIDDLEWARE
:
MIDDLEWARE = [
'django_brotli.middleware.BrotliMiddleware',
# ...
]
git clone ...
)poetry install --with dev -v
pytest