Migrating from django-sendfile

django-sendfile [1] is a wrapper around web-server specific methods for sending files to web clients. See Alternatives and related projects for details about this project.

django-downloadview provides a port of django-sendfile's main function.


django-downloadview can replace the following django-sendfile’s backends: nginx, xsendfile, simple. But it currently cannot replace mod_wsgi backend.

Here are tips to migrate from django-sendfile to django-downloadview

  1. In your project’s and apps dependencies, replace django-sendfile by django-downloadview.
  2. In your Python scripts, replace import sendfile and from sendfile by import django_downloadview and from django_downloadview. You get something like from django_downloadview import sendfile
  3. Adapt your settings as explained in Configure. Pay attention to:
    • replace sendfile by django_downloadview in INSTALLED_APPS.
    • setup DOWNLOADVIEW_RULES. It replaces SENDFILE_ROOT and can do more.
    • register django_downloadview.SmartDownloadMiddleware in MIDDLEWARE_CLASSES.
  4. Change your tests if any. You can no longer use django-senfile’s development backend. See Write tests for django-downloadview’s toolkit.
  5. Here you are! … or please report your story/bug at django-downloadview’s bugtracker [2] ;)