mirror of
https://github.com/jazzband/django-downloadview.git
synced 2026-03-16 22:40:25 +00:00
81 lines
2.3 KiB
Text
81 lines
2.3 KiB
Text
#########
|
|
Configure
|
|
#########
|
|
|
|
Here is the list of Django settings for `django-downloadview`.
|
|
|
|
|
|
**************
|
|
INSTALLED_APPS
|
|
**************
|
|
|
|
There is no need to register this application in ``INSTALLED_APPS``.
|
|
|
|
|
|
******************
|
|
MIDDLEWARE_CLASSES
|
|
******************
|
|
|
|
If you plan to setup :doc:`reverse-proxy optimizations </optimizations/index>`,
|
|
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
|
|
:start-after: BEGIN middlewares
|
|
:end-before: END middlewares
|
|
|
|
|
|
********************
|
|
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
|
|
:start-after: BEGIN backend
|
|
:end-before: END backend
|
|
|
|
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
|
|
:start-after: BEGIN rules
|
|
:end-before: END rules
|
|
|
|
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.
|