Debian Codegraph @

/

0 files · 0 symbols
README (full)

django-downloadview

:target: https://jazzband.co/ :alt: Jazzband

:target: https://pypi.python.org/pypi/django-downloadview

:target: https://pypi.python.org/pypi/django-downloadview

:target: https://pypi.python.org/pypi/django-downloadview

:target: https://pypi.python.org/pypi/django-downloadview

:target: https://github.com/jazzband/django-downloadview/actions :alt: GitHub Actions

:target: https://codecov.io/gh/jazzband/django-downloadview :alt: 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

dir .github/
dir debian/
dir demo/
dir django_downloadview/
dir django_downloadview.egg-info/
dir docs/
dir tests/
file .gitignore
file .isort.cfg
file .pre-commit-config.yaml
file .readthedocs.yaml
file AUTHORS
file CHANGELOG
file CODE_OF_CONDUCT.md
file CONTRIBUTING.rst
file INSTALL
file LICENSE
file MANIFEST.in
file Makefile
file PKG-INFO
file README.rst
file setup.cfg
file setup.py
file tox.ini