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.10.tar.gz (26.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_downloadview-1.10-py3-none-any.whl (35.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: django-downloadview-1.10.tar.gz
  • Upload date:
  • Size: 26.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/40.7.1 requests-toolbelt/0.8.0 tqdm/4.19.7 CPython/3.6.9

File hashes

Hashes for django-downloadview-1.10.tar.gz
Algorithm Hash digest
SHA256 14a92fa1f309be6a32464563497235e271471d70dc226695e6b4ee8c978b3670
MD5 d159bc8c3fcde7f58ceb79073be5b79e
BLAKE2b-256 e327129460771919d592c64d36d8a4626c43991498057f242875eece0448884e

See more details on using hashes here.

File details

Details for the file django_downloadview-1.10-py3-none-any.whl.

File metadata

  • Download URL: django_downloadview-1.10-py3-none-any.whl
  • Upload date:
  • Size: 35.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/40.7.1 requests-toolbelt/0.8.0 tqdm/4.19.7 CPython/3.6.9

File hashes

Hashes for django_downloadview-1.10-py3-none-any.whl
Algorithm Hash digest
SHA256 e088739392b973dc14608bbad6ff50165e6540e952f1dd43d1bc59c716f0a0d9
MD5 1a8e105f5bb7b1c0d3afdb10984b47b1
BLAKE2b-256 f70c221f919c5e41fe2e53eec01d5e18b99a6cb80f51d8f89ca4deb3320753b0

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