Skip to main content

Serve files with Django and reverse-proxies.

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-downloadview-1.7.tar.gz (26.2 kB view details)

Uploaded Source

File details

Details for the file django-downloadview-1.7.tar.gz.

File metadata

File hashes

Hashes for django-downloadview-1.7.tar.gz
Algorithm Hash digest
SHA256 867cefd3a2170e9df31c248909c4c8811c39f3f44298e944632814e19a6b92c0
MD5 6664d635585bae1a40bdc2b8155258f5
BLAKE2b-256 dea6fb4a75f096d6e09d74548efd99a4dec4116b7c032c50392d5b40c1274f14

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page