Serve files with Django.
Find a file
Rémy HUBSCHER 1b294f00fa
Merge pull request #212 from sevdog/xaccel-headers
Allow XResponses to keep original headers provided to base response
2024-08-05 10:23:48 +02:00
.github/workflows Upgrade support matrix to maintained versions of Django 2024-07-30 10:03:32 +00:00
demo Allow XResponses to keep original headers provided to base response 2024-08-01 08:35:53 +02:00
django_downloadview Merge pull request #212 from sevdog/xaccel-headers 2024-08-05 10:23:48 +02:00
docs Replace use of pkg_resources (setuptools) 2024-07-31 11:41:25 +00:00
tests Replace use of pkg_resources (setuptools) 2024-07-31 11:41:25 +00:00
.gitignore Drop support for end of life Django settings in demo project 2021-01-21 11:28:40 -05:00
.isort.cfg Migrate to GitHub Actions. (#165) 2020-12-23 11:12:35 +01:00
AUTHORS Prepare 2.3 release. 2022-01-11 10:37:35 +01:00
CHANGELOG Drop Python 3.6 support 2022-08-04 09:22:28 -04:00
CODE_OF_CONDUCT.md Jazzband: Created local 'CODE_OF_CONDUCT.md' from remote 'CODE_OF_CONDUCT.md' 2022-02-17 11:46:17 +01:00
CONTRIBUTING.rst Be ready for Jazzband move. 2020-09-18 16:50:33 +02:00
INSTALL Drop Python 3.6 support 2022-08-04 09:22:28 -04:00
LICENSE Refs #74 - Switched to tox as test-environment manager. Added flake8 to the test suite. Dropped python 2.6 tests. Makefile no longer creates a virtualenv. 2014-02-10 01:27:14 +01:00
Makefile Migrate to GitHub Actions. (#165) 2020-12-23 11:12:35 +01:00
MANIFEST.in Migrate to GitHub Actions. (#165) 2020-12-23 11:12:35 +01:00
README.rst Add Django supported version badge to README.rst. 2021-04-16 14:30:02 +02:00
setup.py Replace use of pkg_resources (setuptools) 2024-07-31 11:41:25 +00:00
tox.ini Upgrade support matrix to maintained versions of Django 2024-07-30 10:03:32 +00:00

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


*********
Resources
*********

* Documentation: https://django-downloadview.readthedocs.io
* PyPI page: http://pypi.python.org/pypi/django-downloadview
* 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

.. _`Django`: https://djangoproject.com