只要 POST 请求任务,Python Flask 网页就会停顿
在 Python Flask 中,我发送带有一些网络任务的 POST 请求。 一切工作正常,但只要任务正在处理,Flask 网站就会停止(冻结)。 例如,只要任务持续,animated.gif 也会冻结。 我尝试了 app.run(threaded=True),但这并没有改变。
有什么建议吗?
In Python Flask I'm sending a POST request with some network tasks.
All works fine, but the Flask website stalls (freezes) as long as the task is working on it.
For example animated.gif also freezes as long as the task is lasting.
I tried app.run(threaded=True), but that doesn't change.
Any suggestion?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果我理解正确的话,设置theaded=True,仅意味着它将处理多个请求,但每个请求仍然由单个线程处理。如果您无法减少处理时间,您可以尝试更好的方法来处理 UI 上长时间运行的任务。
If I understand correctly, setting theaded=True, only means that it will process multiple request but each request is still handled by a single thread. If you can't cut down on the processing time, you could try better ways for dealing with the long running task on the UI.