Serve files with Django.
Find a file
2013-05-28 15:51:32 +02:00
demo Refs #32 - Respect 'attachment' argument in X-Accel optimization. 2013-05-06 16:50:47 +02:00
django_downloadview Refs #26 - Do not compute size of virtual files, unless file wrapper implements was_modified_since(). 2013-05-28 15:17:01 +02:00
docs Refs #34 - Merged branch 34-modification-time. 2013-05-28 08:41:23 +02:00
etc Upgraded zest.releaser to version 3.45 (support of VERSION file). 2013-05-28 15:50:43 +02:00
tests Refs #26 - Fixed assertIs() compatibility for Python<2.7 2013-05-28 15:21:55 +02:00
.gitignore Improved Makefile + some other minor improvements 2013-03-20 16:21:48 +01: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 Preparing release 1.2 2013-05-28 15:51:32 +02:00
INSTALL Reviewed documentation. 2013-04-11 15:02:45 +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 Refs #35 - Fixed conversion of README from reStructuredText to HTML. 2013-05-28 14:40:46 +02:00
setup.py Refs #29 - Introduced HTTPFile and HTTPDownloadView to create proxy to arbitrary HTTP URL. 2013-04-08 15:39:06 +02:00
VERSION Preparing release 1.2 2013-05-28 15:51:32 +02:00

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

Django-DownloadView provides generic views to make Django serve files.

It can 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