mirror of
https://github.com/jazzband/django-downloadview.git
synced 2026-05-13 18:13:15 +00:00
51 lines
1.3 KiB
Text
51 lines
1.3 KiB
Text
##################
|
|
Optimize streaming
|
|
##################
|
|
|
|
Some reverse proxies allow applications to delegate actual download to the
|
|
proxy:
|
|
|
|
* with Django, manage permissions, generate files...
|
|
* let the reverse proxy serve the file.
|
|
|
|
As a result, you get increased performance: reverse proxies are more efficient
|
|
than Django at serving static files.
|
|
|
|
The setup depends on the reverse proxy:
|
|
|
|
.. toctree::
|
|
:titlesonly:
|
|
|
|
nginx
|
|
|
|
.. note::
|
|
|
|
Currently, only `nginx's X-Accel`_ is supported, but `contributions are
|
|
welcome`_!
|
|
|
|
|
|
*****************
|
|
How does it work?
|
|
*****************
|
|
|
|
View return some :class:`~django_downloadview.response.DownloadResponse`
|
|
instance, which itself carries a :doc:`file wrapper </files>`.
|
|
|
|
`django-downloadview` provides response middlewares and decorators that are
|
|
able to capture :class:`~django_downloadview.response.DownloadResponse`
|
|
instances and convert them to
|
|
:class:`~django_downloadview.response.ProxiedDownloadResponse`.
|
|
|
|
.. note::
|
|
|
|
The feature is inspired by :mod:`Django's TemplateResponse
|
|
<django.template.response>`
|
|
|
|
|
|
.. rubric:: Notes & references
|
|
|
|
.. target-notes::
|
|
|
|
.. _`nginx's X-Accel`: http://wiki.nginx.org/X-accel
|
|
.. _`contributions are welcome`:
|
|
https://github.com/benoitbryon/django-downloadview/issues?labels=optimizations
|