I want to download a file from a URL. Actually, I want to get the file from a URL and return it when the user requests to get that file for download. I am using this codes:
def download(request):
file = 'example.com/video.mp4''
name = 'file name'
response = HttpResponse(file)
response['Content-Disposition'] = f'attachment; filename={name}'
return response
but it cant return file for download. These codes return a file, but the file is not in the URL. how can I fix it?