I am trying to serve a download file in my django app, after a bit of research I made the code below but there is one problem, the file is opened in the browser instead of being downloaded.
The files that I serve on my app are exe, and when they open it's just a bunch of random characters.
So how can I specify that I want the file to be downloaded, not opened? Thank you
with open(path_to_apk, 'rb') as fh:
response = HttpResponse(fh)
response['Content-Disposition'] = 'inline; filename=' + os.path.basename(path_to_apk)
return response`