django-downloadview/README

62 lines
1.8 KiB
Text
Raw Normal View History

###################
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.
2013-04-11 13:42:28 +00:00
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!
2013-04-11 13:42:28 +00:00
*****
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
**********
2013-03-20 15:27:58 +00:00
* Documentation: http://django-downloadview.readthedocs.org
* PyPI page: http://pypi.python.org/pypi/django-downloadview
2013-03-20 15:27:58 +00:00
* 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