Serve files with Django.
Find a file
2013-10-21 14:29:12 +02:00
demo Introduced DownloadDispatcherMiddleware and settings.DOWNLOADVIEW_MIDDLEWARES. Deprecated most options for former global XAccelRedirectMiddleware. Splitted nginx module into a package. Introduced BaseDownloadMiddleware. 2013-10-04 18:11:16 +02:00
django_downloadview Introduced DownloadDispatcherMiddleware and settings.DOWNLOADVIEW_MIDDLEWARES. Deprecated most options for former global XAccelRedirectMiddleware. Splitted nginx module into a package. Introduced BaseDownloadMiddleware. 2013-10-04 18:11:16 +02:00
docs Using sphinx.ext.intersphinx to reference Django and Python documentations. 2013-10-21 14:26:46 +02:00
etc Enabled collective.recipe.omelette in DEV environment. 2013-10-21 14:29:12 +02:00
tests Refs #26 - Fixed assertIs() compatibility for Python<2.7 2013-05-28 15:21:55 +02:00
.gitignore Enhanced buildout configuration for development environment: using crate.io, upgraded to python-termstyle 0.1.10. 2013-07-26 01:38:38 +02:00
.travis.yml Added support for TravisCI.org. 2013-03-20 16:22:38 +01:00
AUTHORS Improved Makefile + some other minor improvements 2013-03-20 16:21:48 +01:00
CHANGELOG Introduced DownloadDispatcherMiddleware and settings.DOWNLOADVIEW_MIDDLEWARES. Deprecated most options for former global XAccelRedirectMiddleware. Splitted nginx module into a package. Introduced BaseDownloadMiddleware. 2013-10-04 18:11:16 +02:00
INSTALL Introduced DownloadDispatcherMiddleware and settings.DOWNLOADVIEW_MIDDLEWARES. Deprecated most options for former global XAccelRedirectMiddleware. Splitted nginx module into a package. Introduced BaseDownloadMiddleware. 2013-10-04 18:11:16 +02:00
LICENSE Improved Makefile + some other minor improvements 2013-03-20 16:21:48 +01:00
Makefile Refs #34 - Introduced unit tests for DownloadMixin.was_modified_since(). Refactored DownloadMixin: easier to test, better docstrings. 2013-05-14 00:25:30 +02:00
MANIFEST.in Reviewed documentation. Preparing first public release. 2012-12-04 11:47:37 +01:00
README Introduced DownloadDispatcherMiddleware and settings.DOWNLOADVIEW_MIDDLEWARES. Deprecated most options for former global XAccelRedirectMiddleware. Splitted nginx module into a package. Introduced BaseDownloadMiddleware. 2013-10-04 18:11:16 +02:00
setup.py Changed encoding declaration style in setup.py. 2013-10-21 14:27:38 +02:00
VERSION Back to development: 1.3 2013-05-28 15:52:26 +02:00

###################
django-downloadview
###################

`django-downloadview` makes it easy to serve files with Django.

It provides generic views to serve files from models, storages, local
filesystem, arbitrary URL... and even generated files.

For increased performances, it can delegate the actual streaming to a reverse
proxy, via mechanisms such as Nginx's X-Accel.


*******
Example
*******

In some ``urls.py``, serve files managed in a model:

.. code-block:: python

   from django.conf.urls import url, url_patterns
   from django_downloadview import ObjectDownloadView
   from demoproject.download.models import Document  # A model with a FileField

   # ObjectDownloadView inherits from django.views.generic.BaseDetailView.
   download = ObjectDownloadView.as_view(model=Document, file_field='file')

   url_patterns = ('',
       url('^download/(?P<slug>[A-Za-z0-9_-]+)/$', download, name='download'),
   )

More examples in the "demo" documentation!


*****
Views
*****

Several views are provided to cover frequent use cases:

* ``ObjectDownloadView`` when you have a model with a file field.
* ``StorageDownloadView`` when you manage files in a storage.
* ``PathDownloadView`` when you have an absolute filename on local filesystem.
* ``HTTPDownloadView`` when you have an URL (the resource is proxied).
* ``VirtualDownloadView`` when you the file is generated on the fly.

See "views" documentation for details.

See also "optimizations" documentation to get increased performances.


**********
Ressources
**********

* Documentation: http://django-downloadview.readthedocs.org
* PyPI page: http://pypi.python.org/pypi/django-downloadview
* Code repository: https://github.com/benoitbryon/django-downloadview
* Bugtracker: https://github.com/benoitbryon/django-downloadview/issues
* Continuous integration: https://travis-ci.org/benoitbryon/django-downloadview