Skip to content Skip to sidebar Skip to footer

Stream Music With Byte Range Requests With Django + Nginx

I am building a music player application with Django + nginx for which I need a backend which supports byte range requests. Django is authenticating the media file correctly but d

Solution 1:

response = HttpResponse(content_type = mimetype, status=206)
response['Content-Disposition'] = "attachment; filename=%s" % \
                                         (fileModel.FileName)
response['Accept-Ranges'] = 'bytes'
response['X-Accel-Redirect'] = settings.MEDIA_URL + '/' + fileModel.FileData.MD5
response['X-Accel-Buffering'] = 'no'
return response

This worked out for me. Now authentication with django + streaming with nginx is accomplished.


Post a Comment for "Stream Music With Byte Range Requests With Django + Nginx"