I am trying to serve MP3 files to django templates which can be used in audio tag. I am using the following view.
def get_file(request):
filename = FILE_PATH + '\\' + files['k']
wrapper = FileWrapper(file(filename))
response = HttpResponse(wrapper, content_type='audio/mp3')
response['Content-Length'] = os.path.getsize(filename)
return response
But I am not able to get the file , while I visit the URL corresponding to the view its just serves a zero kb MP3 file.