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
.
This software is in alpha version and should not be used in production.
- Supported Python versions are:
3.5
,3.6
and3.7
. - Supported Django versions are:
1.11.x
(LTS),2.0.x
and2.1.x
(LTS).
pip install --upgrade django-brotli
Add django_brotli.middleware.BrotliMiddleware
to MIDDLEWARE
:
MIDDLEWARE = [
'django_brotli.middleware.BrotliMiddleware',
# ...
]
- Brotli on Wikipedia (https://en.wikipedia.org/wiki/Brotli)
- Brotli compression format repository by Google (https://github.com/google/brotli)
- Clone this repository (
git clone ...
) - Create virtualenv
- Install package dependencies:
pip install --upgrade -r requirements.txt
- Change some code
- Run tests: in project root simply execute
pytest
- Submit PR :)
The MIT License (MIT)
Copyright (c) 2016–2019 Vašek Dohnal (@illagrenan)