项目作者: illagrenan

项目描述 :
Django middleware that compresses response using brotli algorithm.
高级语言: Python
项目地址: git://github.com/illagrenan/django-brotli.git
创建时间: 2016-11-01T13:20:20Z
项目社区:https://github.com/illagrenan/django-brotli

开源协议:MIT License

下载


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.14".
  • Supported Django versions are: >=4,<6.
  1. poetry add django-brotli@latest

or

  1. pip install --upgrade django-brotli

Add django_brotli.middleware.BrotliMiddleware to MIDDLEWARE:

  1. MIDDLEWARE = [
  2. 'django_brotli.middleware.BrotliMiddleware',
  3. # ...
  4. ]

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)