Skip to main content

Serve files with Django and reverse-proxies.

Project description

Jazzband https://img.shields.io/pypi/v/django-downloadview.svg https://img.shields.io/pypi/pyversions/django-downloadview.svg https://img.shields.io/pypi/djversions/django-downloadview.svg https://img.shields.io/pypi/dm/django-downloadview.svg GitHub Actions Coverage

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-2.5.0.tar.gz (67.2 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-2.5.0-py3-none-any.whl (36.1 kB view details)

Uploaded Python 3

File details

Details for the file django_downloadview-2.5.0.tar.gz.

File metadata

  • Download URL: django_downloadview-2.5.0.tar.gz
  • Upload date:
  • Size: 67.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.4

File hashes

Hashes for django_downloadview-2.5.0.tar.gz
Algorithm Hash digest
SHA256 3bf0b0694711cadb4a9c1173cb21055a3f3be14c092e132ec3d69f14b4d8fdfe
MD5 b2e07a5a41e139148cd0bb3d92e8ec8b
BLAKE2b-256 fcb27182dbce076e5f95105c2ef8c0f172cc1e6c09d990604cc901661d618d82

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for django_downloadview-2.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b9faa2e6a24ad521d19f9c16ae99010fcb921a8e9dd4e6db4972df72bdcfe726
MD5 d54ad3f073c58c16a1fa875368b214bb
BLAKE2b-256 6a924df0306aa24a1f1888bca2697475491794a5d29b070104ba823f9583e5aa

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