I'm deploying my flask
api on heroku
and I already use gunicorn
to enable the use of multiple processes
This is my procfile:
web: gunicorn app:app
on heroku docs they suggest using the WEB_CONCURRENCY
environment variable but considering I don't know how many workers O need for my application I will let heroku config that for me
The WEB_CONCURRENCY
environment variable is automatically set by
Heroku, based on the processes’ Dyno size. This feature is intended to
be a sane starting point for your application. We recommend knowing
the memory requirements of your processes and setting this
configuration variable accordingly.
I saw that you need to specify, in app.run()
, that the app enables multithread (app.run(threaded=True)
) but I haven't
So my question is: using gunicorn
has the same effect as setting app.run(threaded=True)
? or i need to also set app.run(threaded=True)
?
question from:
https://stackoverflow.com/questions/65882317/gunicorn-and-flask-threading-produce-the-same-result 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…