Skip to main content

Middleware that compresses response using brotli algorithm.

Project description

PyPi MIT TravisCI Coverage Updates Supported Python implementations Supported Python versions

Introduction

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.

Installation

This software is in alpha version and should not be used in production.

  • Supported Python versions are: 3.5, 3.6 and 3.7.
  • Supported Django versions are: 1.11.x (LTS), 2.0.x and 2.1.x (LTS).
pip install --upgrade django-brotli

Add django_brotli.middleware.BrotliMiddleware to MIDDLEWARE:

MIDDLEWARE = [
    'django_brotli.middleware.BrotliMiddleware',
    # ...
]

Contributing

  1. Clone this repository (git clone ...)
  2. Create virtualenv
  3. Install package dependencies: pip install --upgrade -r requirements.txt
  4. Change some code
  5. Run tests: in project root simply execute pytest
  6. Submit PR :)

License

The MIT License (MIT)

Copyright (c) 2016–2019 Vašek Dohnal (@illagrenan)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for django-brotli, version 0.2.0
Filename, size File type Python version Upload date Hashes
Filename, size django_brotli-0.2.0-py2.py3-none-any.whl (4.9 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size django_brotli-0.2.0-py3-none-any.whl (4.9 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size django-brotli-0.2.0.tar.gz (4.6 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page