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.
Warning
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…
In your project’s and apps dependencies, replace
django-sendfilebydjango-downloadview.In your Python scripts, replace
import sendfileandfrom sendfilebyimport django_downloadviewandfrom django_downloadview. You get something likefrom django_downloadview import sendfileAdapt your settings as explained in Configure. Pay attention to:
replace
sendfilebydjango_downloadviewinINSTALLED_APPS.replace
SENDFILE_BACKENDbyDOWNLOADVIEW_BACKENDsetup
DOWNLOADVIEW_RULES. It replacesSENDFILE_ROOTand can do more.register
django_downloadview.SmartDownloadMiddlewareinMIDDLEWARE.
Change your tests if any. You can no longer use django-senfile’s
developmentbackend. See Write tests for django-downloadview’s toolkit.Here you are! … or please report your story/bug at django-downloadview’s bugtracker [2] ;)
API reference¶
- django_downloadview.shortcuts.sendfile(request, filename, attachment=False, attachment_filename=None, mimetype=None, encoding=None)¶
Port of django-sendfile’s API in django-downloadview.
Instantiates a
PathDownloadViewto stream the file byfilename.
References