Metadata-Version: 2.1
Name: django-brotli
Version: 0.2.0
Summary: Middleware that compresses response using brotli algorithm.
Home-page: https://github.com/illagrenan/django-brotli
Author: Vasek Dohnal
Author-email: vaclav.dohnal@gmail.com
License: MIT
Classifier: Development Status :: 4 - Beta
Classifier: Framework :: Django
Classifier: Framework :: Django :: 1.11
Classifier: Framework :: Django :: 2.0
Classifier: Framework :: Django :: 2.1
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Requires-Python: ~=3.5
License-File: LICENSE
Requires-Dist: django
Requires-Dist: brotli

===========================================================================
Django Brotli: *Middleware that compresses response using brotli algorithm*
===========================================================================

.. image:: https://img.shields.io/pypi/v/django-brotli.svg
    :target: https://pypi.python.org/pypi/django-brotli
    :alt: PyPi

.. image:: https://img.shields.io/badge/license-MIT-blue.svg
    :target: https://pypi.python.org/pypi/django-brotli/
    :alt: MIT

.. image:: https://img.shields.io/travis/illagrenan/django-brotli.svg
    :target: https://travis-ci.org/illagrenan/django-brotli
    :alt: TravisCI

.. image:: https://img.shields.io/coveralls/illagrenan/django-brotli.svg
    :target: https://coveralls.io/github/illagrenan/django-brotli?branch=master
    :alt: Coverage

.. image:: https://pyup.io/repos/github/illagrenan/django-brotli/shield.svg
    :target: https://pyup.io/repos/github/illagrenan/django-brotli/
    :alt: Updates

.. image:: https://img.shields.io/pypi/implementation/django-brotli.svg
    :target: https://pypi.python.org/pypi/django_brotli/
    :alt: Supported Python implementations

.. image:: https://img.shields.io/pypi/pyversions/django-brotli.svg
    :target: https://pypi.python.org/pypi/django_brotli/
    :alt: 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``.

.. _`Docs`: https://docs.djangoproject.com/en/dev/ref/middleware/#module-django.middleware.gzip
.. _`Source`: https://github.com/django/django/blob/master/django/middleware/gzip.py#L10-L52
.. _`RFC 7932`: https://www.ietf.org/rfc/rfc7932.txt
.. _`caniuse`: http://caniuse.com/#search=brotli

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).

.. code:: shell

    pip install --upgrade django-brotli


Add ``django_brotli.middleware.BrotliMiddleware`` to ``MIDDLEWARE``:

.. code:: python

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


Credits and Resources
---------------------

- `Brotli on Wikipedia (https://en.wikipedia.org/wiki/Brotli) <https://en.wikipedia.org/wiki/Brotli>`_
- `Brotli compression format repository by Google (https://github.com/google/brotli) <https://github.com/google/brotli>`_


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)
