#########
Configure
#########

Here is the list of settings used by `django-downloadview`.


**************
INSTALLED_APPS
**************

There is no need to register this application in your Django's
``INSTALLED_APPS`` setting.


******************
MIDDLEWARE_CLASSES
******************

If you plan to setup reverse-proxy optimizations, add
``django_downloadview.SmartDownloadMiddleware`` to ``MIDDLEWARE_CLASSES``.
It is a response middleware. Move it after middlewares that compute the
response content such as gzip middleware.

Example:

.. literalinclude:: /../demo/demoproject/settings.py
   :language: python
   :lines: 62-69


********************
DOWNLOADVIEW_BACKEND
********************

This setting is used by
:class:`~django_downloadview.middlewares.SmartDownloadMiddleware`.
It is the import string of a callable (typically a class) of an optimization
backend (typically a :class:`~django_downloadview.BaseDownloadMiddleware`
subclass).

Example:

.. literalinclude:: /../demo/demoproject/settings.py
   :language: python
   :lines: 73

See :doc:`/optimizations/index` for a list of available backends (middlewares).

When ``django_downloadview.SmartDownloadMiddleware`` is in your
``MIDDLEWARE_CLASSES``, this setting must be explicitely configured (no default
value). Else, you can ignore this setting.


******************
DOWNLOADVIEW_RULES
******************

This setting is used by
:class:`~django_downloadview.middlewares.SmartDownloadMiddleware`.
It is a list of positional arguments or keyword arguments that will be used to
instanciate class mentioned as ``DOWNLOADVIEW_BACKEND``.

Each item in the list can be either a list of positional arguments, or a
dictionary of keyword arguments. One item cannot contain both positional and
keyword arguments.

Here is an example containing one rule using keyword arguments:

.. literalinclude:: /../demo/demoproject/settings.py
   :language: python
   :lines: 74-77

See :doc:`/optimizations/index` for details about builtin backends
(middlewares) and their options.

When ``django_downloadview.SmartDownloadMiddleware`` is in your
``MIDDLEWARE_CLASSES``, this setting must be explicitely configured (no default
value). Else, you can ignore this setting.
