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/jazzband/django-downloadview
Bugtracker: https://github.com/jazzband/django-downloadview/issues
Continuous integration: https://github.com/jazzband/django-downloadview/actions
Roadmap: https://github.com/jazzband/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.3.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9abaa054a349143fa07107788bd8b59dfcee045e16805e05d2fb305142fac481 |
|
MD5 | afcc6ca55a4a7a0cfc65ff1bfa7cd2d9 |
|
BLAKE2b-256 | a81ccc1d3a1abf52d52c631b920d2f99fb7038c85053192f4185e39cd6aef072 |
Hashes for django_downloadview-2.3.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ad0dd0250f471f2de5d3d5355648ecb8c9f19d13e0a93c13238a111a20828fbb |
|
MD5 | 7eb720946e245a5555150f0f51e25d9b |
|
BLAKE2b-256 | c01aaf5739ee36e1876be1b24e6071ac12d3ed384bef78b106cdd3e671252e49 |