HTTPDownloadView serves a file given an URL., i.e. it acts like a proxy.

This view is particularly handy when:

  • the client does not have access to the file resource, while your Django server does.
  • the client does trust your server, your server trusts a third-party, you do not want to bother the client with the third-party.

Simple example

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 (

class GithubAvatarDownloadView(HTTPDownloadView):
    def get_url(self):
        return ""

simple_url = SimpleURLDownloadView.as_view()
avatar_url = GithubAvatarDownloadView.as_view()

Base options

HTTPDownloadView inherits from DownloadMixin, which has various options such as basename or attachment.

API reference