Serve files with Django.
Find a file
Peter Marheine 95b36fc843 Import ABCs from collections.abc, not collections
The types in collections.abc were moved from just collections in Python
3.3, and Python 3.10 removed the old aliases. We no longer support
Python versions earlier than 3.3 and need to support 3.10, so update the
import.
2021-12-23 10:27:14 +11:00
.github/workflows Add Django 3.2 support. 2021-04-16 14:30:02 +02:00
demo Merge pull request #171 from johnthagen/demo-python-version 2021-01-21 17:39:06 +01:00
django_downloadview Import ABCs from collections.abc, not collections 2021-12-23 10:27:14 +11:00
docs Merge pull request #179 from johnthagen/storage-download-docs 2021-04-10 18:53:18 +02:00
tests Migrate to GitHub Actions. (#165) 2020-12-23 11:12:35 +01: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 Fix links. 2021-01-21 17:45:42 +01:00
CHANGELOG Add Django 3.2 support. 2021-04-16 14:30:02 +02:00
CONTRIBUTING.rst Be ready for Jazzband move. 2020-09-18 16:50:33 +02:00
INSTALL Add signed file system storage 2020-01-13 11:25:40 +02: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 Remove duplicate trove classifier 2021-04-27 19:09:12 -04:00
tox.ini Add Django 3.2 support. 2021-04-16 14:30:02 +02: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