python icon indicating copy to clipboard operation
python copied to clipboard

Use gunicorn to serve the app

Open wilzbach opened this issue 6 years ago • 2 comments

First fix for https://github.com/microservices/python/issues/4.

It probably makes sense to use uvicorn or similar as a next improvement.

  • https://gist.github.com/erm/130ff4fa7b4d428f4e98057858795aba
  • https://www.uvicorn.org/deployment/
  • https://github.com/tiangolo/uvicorn-gunicorn-docker
  • https://gist.github.com/Midnighter/6f848a1b2264fa453706284305673834

Another option would be to use uswgi + nginx, but that's a bit more complicated:

  • https://smirnov-am.github.io/2018/08/09/flask-docker.html
  • https://ianlondon.github.io/blog/deploy-flask-docker-nginx/

wilzbach avatar Apr 07 '19 16:04 wilzbach

@wilzbach there is also https://github.com/kennethreitz/responder which is a solid project for ASGI apps. I was planning on changing Flask to Responder. Assume that works with gunicorn too

stevepeak avatar Apr 08 '19 06:04 stevepeak

it can work with gunicorn, but you need a different worker class, fyi.

kennethreitz avatar Apr 29 '19 13:04 kennethreitz