处理Flask中的多个请求 [英] Handling multiple requests in Flask

查看:493
本文介绍了处理Flask中的多个请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Flask应用程序必须做相当大的计算来获取某个页面。当Flask正在执行此功能时,另一个用户无法访问该网站,因为Flask忙于大量计算。



有什么方法可以让我的Flask应用程序接受是的,将您的应用程序部署在不同的WSGI服务器上,请参阅 //flask.pocoo.org/docs/deploying/rel =noreferrer> Flask部署选项文档



Flask附带的服务器组件真的只是当你开发你的应用程序的时候,即使它可以配置为处理并发请求(使用 app.run(threaded = True))。上面的文档列出了几个可以处理并发请求的选项,它们更健壮可调。


My Flask applications has to do quite a large calculation to fetch a certain page. While Flask is doing that function, another user cannot access the website, because Flask is busy with the large calculation.

Is there any way that I can make my Flask application accept requests from multiple users?

解决方案

Yes, deploy your application on a different WSGI server, see the Flask deployment options documentation.

The server component that comes with Flask is really only meant for when you are developing your application; even though it can be configured to handle concurrent requests (with app.run(threaded=True)). The above document lists several options for servers that can handle concurrent requests and are far more robust and tuneable.

这篇关于处理Flask中的多个请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆