def content_download(request, content_id): content = models.Content.objects.get(pk=content_id) response = StreamingHttpResponse(open(content.file, "r")) response["Content-Type"] = "application/octet-stream" response["Content-Disposition"] = 'attachment; filename="%s"' % os.path.basename( content.file ) return response