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
Documentation: https://django-downloadview.readthedocs.io
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for django_downloadview-1.10-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e088739392b973dc14608bbad6ff50165e6540e952f1dd43d1bc59c716f0a0d9 |
|
MD5 | 1a8e105f5bb7b1c0d3afdb10984b47b1 |
|
BLAKE2b-256 | f70c221f919c5e41fe2e53eec01d5e18b99a6cb80f51d8f89ca4deb3320753b0 |