简体   繁体   English

Connexion Python框架设置多进程

[英]Connexion Python framework set multiprocesses

I try to configure Connexion to set the number of processes or threads as is possible in Flask framework. 我尝试配置Connexion以设置Flask框架中可能的进程或线程数。 This is possible in Flask but it seems that Connexion is not sending this configuration to Flask. 这在Flask中是可能的,但似乎Connexion没有将此配置发送到Flask。 I read the Connexion documentation but I didn't find anything. 我阅读了Connexion文档,但未找到任何内容。 Is this possible? 这可能吗?

app = connexion.App(__name__, specification_dir='swagger/', debug=False, processes=4)
app.run(port=8080, server='gevent')

I try to set the parameters in connexion.App but you can't set this kargs. 我尝试在connexion.App中设置参数,但是您无法设置此参数。

Connexion version: 连接版本:

connexion==1.1.9

I found a workaround for this. 我找到了解决方法。 To run the application with uWSGI. 使用uWSGI运行应用程序。 You can use the Flask WSGI app with any WSGI container. 您可以将Flask WSGI应用程序与任何WSGI容器一起使用。 Using Flask with uWSGI 将Flask与uWSGI一起使用

Here is an example: 这是一个例子:

$ sudo pip3 install uwsgi
$ uwsgi --socket 0.0.0.0:8080 --protocol=http --callable app --file app.py --master -p 4  # use 4 worker processes

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM