from django.http import FileResponse def download(request): if..... file=open([path],'rb') response=FileResponse(file) response['Content-Type'] = 'application/octet-stream' response['Content-Disposition'] = 'attachment;filename="[filename].xls"'
return response
转载于:https://www.cnblogs.com/wang666/p/9214551.html