django-downloadview/README.rst

51 lines
1.5 KiB
ReStructuredText
Raw Normal View History

###################
django-downloadview
###################
2015-06-12 17:30:57 +00:00
`django-downloadview` makes it easy to serve files with `Django`_:
2015-06-12 17:30:57 +00:00
* you manage files with Django (permissions, filters, generation, ...);
2013-04-11 13:42:28 +00:00
2013-10-21 12:30:41 +00:00
* files are stored somewhere or generated somehow (local filesystem, remote
storage, memory...);
2015-06-12 17:30:57 +00:00
* `django-downloadview` helps you stream the files with very little code;
2013-10-21 12:30:41 +00:00
2015-06-12 17:30:57 +00:00
* `django-downloadview` helps you improve performances with reverse proxies,
via mechanisms such as Nginx's X-Accel or Apache's X-Sendfile.
2013-04-11 13:42:28 +00:00
*******
Example
*******
2015-06-12 17:30:57 +00:00
Let's serve a file stored in a file field of some model:
2013-10-21 12:30:41 +00:00
.. code:: 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'),
)
2014-03-31 14:42:35 +00:00
*********
Resources
*********
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
2014-10-28 15:14:08 +00:00
* Roadmap: https://github.com/benoitbryon/django-downloadview/milestones
2015-06-12 17:30:57 +00:00
.. _`Django`: https://djangoproject.com