Serve files with Django.
Find a file
Adam Chainz a4cc84d758 Convert readthedocs links for their .org -> .io migration for hosted projects
As per [their blog post of the 27th April](https://blog.readthedocs.com/securing-subdomains/) ‘Securing subdomains’:

> Starting today, Read the Docs will start hosting projects from subdomains on the domain readthedocs.io, instead of on readthedocs.org. This change addresses some security concerns around site cookies while hosting user generated data on the same domain as our dashboard.

Test Plan: Manually visited all the links I’ve modified.
2016-06-27 22:42:16 +01:00
demo Convert readthedocs links for their .org -> .io migration for hosted projects 2016-06-27 22:42:16 +01:00
django_downloadview HTTPFile has 'content_type' property. Allows HTTPDownloadView to proxy Content-Type header. Refs #116 2016-03-14 17:05:32 +01:00
docs Convert readthedocs links for their .org -> .io migration for hosted projects 2016-06-27 22:42:16 +01:00
tests Improved support of Python-3.5 and Django-1.9. Refs #112, refs #113. 2016-03-14 15:54:56 +01:00
.gitignore Refs #74 - Switched to tox as test-environment manager. Added flake8 to the test suite. Dropped python 2.6 tests. Makefile no longer creates a virtualenv. 2014-02-10 01:27:14 +01:00
.travis.yml Improved support of Python-3.5 and Django-1.9. Refs #112, refs #113. 2016-03-14 15:40:13 +01:00
AUTHORS Refs #25, refs #39, refs #40, refs #42 - Big refactoring in documentation and demo: narrative documentation uses examples from demo project. 2013-10-28 16:58:18 +01:00
CHANGELOG Back to development: 1.10 2016-03-15 12:18:35 +01:00
CONTRIBUTING.rst Reviewed Makefile, development environment and contributor guide. 2014-03-03 14:38:33 +01:00
INSTALL Declared project as production/stable. 2015-06-24 14:10:33 +02:00
LICENSE Refs #74 - Switched to tox as test-environment manager. Added flake8 to the test suite. Dropped python 2.6 tests. Makefile no longer creates a virtualenv. 2014-02-10 01:27:14 +01:00
Makefile Refs #92 - 'make demo' installs demo, 'make runserver' runs demo server. 2015-06-13 00:56:57 +02:00
MANIFEST.in Declared project as production/stable. 2015-06-24 14:10:33 +02:00
README.rst Convert readthedocs links for their .org -> .io migration for hosted projects 2016-06-27 22:42:16 +01:00
setup.py Convert readthedocs links for their .org -> .io migration for hosted projects 2016-06-27 22:42:16 +01:00
tox.ini Added Python-3.5 and Django-1.9 to test suites. Refs #112, refs #113. 2016-03-14 15:22:48 +01:00
VERSION Back to development: 1.10 2016-03-15 12:18:35 +01:00

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

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

* you manage files with Django (permissions, filters, generation, ...);

* files are stored somewhere or generated somehow (local filesystem, remote
  storage, memory...);

* `django-downloadview` helps you stream the files with very little code;

* `django-downloadview` helps you improve performances with reverse proxies,
  via mechanisms such as Nginx's X-Accel or Apache's X-Sendfile.


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

Let's serve a file stored in a file field of some model:

.. 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'),
   )


*********
Resources
*********

* Documentation: https://django-downloadview.readthedocs.io
* 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
* Roadmap: https://github.com/benoitbryon/django-downloadview/milestones


.. _`Django`: https://djangoproject.com