def song_download(request):
    path = '/path/to/file.mp3'
response = HttpResponse()
response['X-Sendfile'] = smart_str(path)
response['Content-Type'] = 'audio/mpeg'
response['Content-Length'] = os.stat(path).st_size
return response
Django: Serving a Download in a Generic View