在“我的生产”文件夹中,有用于存储日志文件的文件夹。我想让html页面使用Django(python)视图从服务器下载“日志文件”(大的.txt文件,大约1.5GB/文件)到客户端计算机。最好的解决方案是什么(下载文件中没有丢失数据,性能良好)
现在我使用这段代码,但下载文件的大小小于服务器中的原始文件:C
with open(file_path, 'rb') as fh:
response = HttpResponse(fh.read(), content_type="application/force-download")
response['Content-Disposition'] = 'inline; filename=' + os.path.basename(file_path)
return response
目前没有回答
相关问题 更多 >
编程相关推荐