只要 POST 请求任务,Python Flask 网页就会停顿

发布于 2025-01-12 05:50:56 字数 161 浏览 2 评论 0原文

在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

猫九 2025-01-19 05:50:56

如果我理解正确的话,设置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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文