Search code examples
pythonflaskconnexion

Connexion Python framework set multiprocesses


I try to configure Connexion to set the number of processes or threads as is possible in Flask framework. This is possible in Flask but it seems that Connexion is not sending this configuration to Flask. I read the Connexion documentation but I didn't find anything. 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 version:

connexion==1.1.9

Solution

  • I found a workaround for this. To run the application with uWSGI. You can use the Flask WSGI app with any WSGI container. Using Flask with 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