Skip to content
Serve files with Django.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
demo Fix flake8 issue Sep 14, 2017
django_downloadview
docs
tests
.gitignore
.travis.yml
AUTHORS
CHANGELOG
CONTRIBUTING.rst
INSTALL
LICENSE Refs #74 - Switched to tox as test-environment manager. Added flake8 … Feb 10, 2014
MANIFEST.in Declared project as production/stable. Jun 24, 2015
Makefile
README.rst Convert readthedocs links for their .org -> .io migration for hosted … Jun 27, 2016
VERSION
setup.py Convert readthedocs links for their .org -> .io migration for hosted … Jun 27, 2016
tox.ini

README.rst

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:

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

You can’t perform that action at this time.