Debian Codegraph @

docs/django-sendfile.txt

raw
1 ##############################
2 Migrating from django-sendfile
3 ##############################
4
5 `django-sendfile`_ is a wrapper around web-server specific methods for sending
6 files to web clients. See :doc:`/about/alternatives` for details about this
7 project.
8
9 `django-downloadview` provides a :func:`port of django-sendfile's main function
10 <django_downloadview.shortcuts.sendfile>`.
11
12 .. warning::
13
14 `django-downloadview` can replace the following `django-sendfile`'s
15 backends: ``nginx``, ``xsendfile``, ``simple``. But it currently cannot
16 replace ``mod_wsgi`` backend.
17
18 Here are tips to migrate from `django-sendfile` to `django-downloadview`...
19
20 1. In your project's and apps dependencies, replace ``django-sendfile`` by
21 ``django-downloadview``.
22
23 2. In your Python scripts, replace ``import sendfile`` and ``from sendfile``
24 by ``import django_downloadview`` and ``from django_downloadview``.
25 You get something like ``from django_downloadview import sendfile``
26
27 3. Adapt your settings as explained in :doc:`/settings`. Pay attention to:
28
29 * replace ``sendfile`` by ``django_downloadview`` in ``INSTALLED_APPS``.
30 * replace ``SENDFILE_BACKEND`` by ``DOWNLOADVIEW_BACKEND``
31 * setup ``DOWNLOADVIEW_RULES``. It replaces ``SENDFILE_ROOT`` and can do
32 more.
33 * register ``django_downloadview.SmartDownloadMiddleware`` in
34 ``MIDDLEWARE``.
35
36 4. Change your tests if any. You can no longer use `django-senfile`'s
37 ``development`` backend. See :doc:`/testing` for `django-downloadview`'s
38 toolkit.
39
40 5. Here you are! ... or please report your story/bug at `django-downloadview's
41 bugtracker`_ ;)
42
43
44 *************
45 API reference
46 *************
47
48 .. autofunction:: django_downloadview.shortcuts.sendfile
49
50
51 .. rubric:: References
52
53 .. target-notes::
54
55 .. _`django-sendfile`: http://pypi.python.org/pypi/django-sendfile
56 .. _`django-downloadview's bugtracker`:
57 https://github.com/jazzband/django-downloadview/issues