Django:文件上传 MemoryError 在 /some/url
当我在服务器上部署后尝试上传大小超过 2 GB 的文件时,出现 MemoryError
异常,但在开发服务器上它工作正常。 应用程序由 Nginx + Gunicorn 提供服务,Nginx 对上传文件大小的限制约为 6Gb。 下面您可以看到处理上传的代码片段
destination = tempfile.NamedTempopraryFile(delete=False)
for chunk in f.chunks():
destination.write(chunk)
destination.close()
临时文件会导致 MemoryError
异常吗?
I get a MemoryError
exception when I try to upload files more than 2 gigs in size after the deployment on the server but with development server it works fine.
Application served by Nginx + gunicorn, Nginx limitation for uploaded file size is about 6Gb.
Below you can see the code fragment which handles uploading
destination = tempfile.NamedTempopraryFile(delete=False)
for chunk in f.chunks():
destination.write(chunk)
destination.close()
Can a temporary file cause MemoryError
exceptions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论