更新时间:2023-01-31 07:50:55
在烧瓶侧面,请确保已将MAX_CONTENT_LENGTH配置值设置得足够高:
On the flask side make sure you have the MAX_CONTENT_LENGTH config value set high enough:
app.config['MAX_CONTENT_LENGTH'] = 100 * 1024 * 1024 # 100MB limit
此外,您可能还想研究Flask-Upload扩展.
Also you may want to look into the Flask-Upload extension.
还有与此类似的另一篇SO帖子:在Flask中上传大文件
There is another SO post similar to this one: Large file upload in Flask.
除此之外,您可能遇到的问题可能是超时.其余堆栈是什么样的?阿帕奇?Nginx和Gunicorn?您是否遇到连接重置
错误,连接超时
错误或只是挂起?
Other than that you problem may be a timeouts somewhere along the line. What does the rest of your stack look like? Apache? Nginx and Gunicorn? Are you getting a Connection reset
error, Connection timed out
error or does it just hang?
如果您使用的是Nginx,请尝试将 proxy_read_timeout
设置为足够高的值以完成上传.Apache可能还有一个默认设置,如果您使用的是默认设置,则会给您带来麻烦.如果不了解更多有关堆栈以及您得到的错误是什么以及日志显示了什么,很难说出来.
If you are using Nginx try setting proxy_read_timeout
to a value high enough for the upload to finish. Apache may also have a default setting causing you trouble if that is what you are using. It's hard to tell without knowing more about your stack and what the error is that you are getting and what the logs are showing.