šŸš€ Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more →
Socket
Sign inDemoInstall
Socket

django-downloadview

Package Overview
Dependencies
Maintainers
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

django-downloadview

Serve files with Django and reverse-proxies.

2.4.0
PyPI
Maintainers
3

################### django-downloadview ###################

.. image:: https://jazzband.co/static/img/badge.svg :target: https://jazzband.co/ :alt: Jazzband

.. image:: https://img.shields.io/pypi/v/django-downloadview.svg :target: https://pypi.python.org/pypi/django-downloadview

.. image:: https://img.shields.io/pypi/pyversions/django-downloadview.svg :target: https://pypi.python.org/pypi/django-downloadview

.. image:: https://img.shields.io/pypi/djversions/django-downloadview.svg :target: https://pypi.python.org/pypi/django-downloadview

.. image:: https://img.shields.io/pypi/dm/django-downloadview.svg :target: https://pypi.python.org/pypi/django-downloadview

.. image:: https://github.com/jazzband/django-downloadview/workflows/Test/badge.svg :target: https://github.com/jazzband/django-downloadview/actions :alt: GitHub Actions

.. image:: https://codecov.io/gh/jazzband/django-downloadview/branch/master/graph/badge.svg :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:

.. code:: python

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[A-Za-z0-9_-]+)/$', download, name='download'), )

Resources

.. _Django: https://djangoproject.com

Keywords

file stream download FileField ImageField x-accel x-accel-redirect x-sendfile sendfile mod_xsendfile offload

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts