This section contains narrative overview about class-based views provided by django-downloadview.
By default, all of those views would stream the file to the client. But keep in mind that you can setup Optimizations to delegate actual streaming to a reverse proxy.
The django_downloadview.views.ObjectDownloadView class-based view allows you to serve files given a model with some file fields such as FileField or ImageField.
Use this view anywhere you could use Django’s builtin ObjectDetailView.
Some options allow you to store file metadata (size, content-type, ...) in the model, as deserialized fields.
The django_downloadview.views.StorageDownloadView class-based view allows you to serve files given a storage and a path.
Use this view when you manage files in a storage (which is a good practice), unrelated to a model.
The django_downloadview.views.PathDownloadView class-based view allows you to serve files given an absolute path on local filesystem.
Two main use cases:
The django_downloadview.views.HTTPDownloadView class-based view allows you to serve files given an URL. That URL is supposed to be downloadable from the Django server.
Use it when you want to setup a proxy to remote files:
Extend django_downloadview.views.HTTPDownloadView then override django_downloadview.views.HTTPDownloadView:get_url().
The django_downloadview.views.VirtualDownloadView class-based view allows you to serve files that don’t live on disk.
Use it when you want to stream a file which content is dynamically generated or which lives in memory.
References
[1] | https://pypi.python.org/pypi/requests |