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-2.1.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff6bc2d7ea4df8b602f5b29b920e40cadd7400851c85cb67c7152b48dcb33a8b |
|
MD5 | cb57bc6d581eee079e90a1b2160b8f21 |
|
BLAKE2b-256 | a25c20740d7d8516eedd5220d25a32f5c5670dceeadd2422d4d54324b2c5fd78 |
Hashes for django_downloadview-2.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4efaa10e2fea6b1b78b3fadd5c8887cc735b0934e1210f29794c14ee6a427aa3 |
|
MD5 | 5f36f402ccefec2e963970e31696a93c |
|
BLAKE2b-256 | 6aa32deb8864be888a10dd4a6405ad8826c60a537b0aadcee7f47232251781c4 |