Skip to main content

Middleware that compresses response using brotli algorithm.

Project description

Django Brotli: Middleware that compresses response using brotli algorithm

License: MIT pypi pypi Python version Supported Django
Build Status codecov

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

  • Supported Python versions are: ">=3.10, <3.15".
  • Supported Django versions are: >=4,<7.
poetry add django-brotli@latest

or

pip install --upgrade django-brotli

Add django_brotli.middleware.BrotliMiddleware to MIDDLEWARE:

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

Credits and Resources

Contributing

  1. Clone this repository (git clone ...)
  2. Install package dependencies: poetry install --with dev -v
  3. Change some code
  4. Run tests: in project root simply execute pytest
  5. Submit PR :)

License

The MIT License (MIT)

Project details


Download files

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

Source Distribution

django_brotli-0.4.0.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_brotli-0.4.0-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file django_brotli-0.4.0.tar.gz.

File metadata

  • Download URL: django_brotli-0.4.0.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for django_brotli-0.4.0.tar.gz
Algorithm Hash digest
SHA256 5c445660049edfc159382899cb84598c406cb693877d3ab82669304105155b52
MD5 8166afd9bfa6a9ba1e7eed0aac499997
BLAKE2b-256 251f797b163de39783744c5ab25a03e423342ef298f19d2cb0d24409be31aa9a

See more details on using hashes here.

File details

Details for the file django_brotli-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: django_brotli-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for django_brotli-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2f8cdfc9de0948891e513258e3e918328b31a3d2509a59445d42a01fa4c308a3
MD5 321a76c034fddc2f3a858dea1c3af211
BLAKE2b-256 38d5cce277130e9ea39ff0386f95daca507427c12a33b608cc94d2958b06d3b2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page