Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
201 views
in Technique[技术] by (71.8m points)

python - Gunicorn and Flask Threading produce the same result?

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...