HTTPDownloadView serves a file given an URL., i.e. it acts like a proxy.
This view is particularly handy when:
Setup a view to stream files given URL:
from django_downloadview import HTTPDownloadView
class SimpleURLDownloadView(HTTPDownloadView):
def get_url(self):
"""Return URL of hello-world.txt file on GitHub."""
return 'https://raw.github.com/benoitbryon/django-downloadview' \
'/b7f660c5e3f37d918b106b02c5af7a887acc0111' \
'/demo/demoproject/download/fixtures/hello-world.txt'
simple_url = SimpleURLDownloadView.as_view()
Bases: django_downloadview.views.base.BaseDownloadView
Proxy files that live on remote servers.
URL to download (the one we are proxying).
Additional keyword arguments for request handler.
Return request factory to perform actual HTTP request.
Default implementation returns requests.get() callable.
Return keyword arguments for use with get_request_factory().
Default implementation returns request_kwargs.
Return wrapper which has an url attribute.