I usually run my Flask applications with uWSGI and an nginx in front of it.
But I was thinking that the same could be achieved with just supervisor and nginx, so I googled around and found a lot of posts on how to setup and the benefits of the uWSGI-supervisor-nginx stack. I've decided to turn to SO, risking getting axed online for such a question.
So what are the benefits of running a Flask application behind uWSGI, supervisor and nginx? Why does apparently no one run Flask applications with only supervisor?
An app server such as gnicorn or uWSGI (used to host the flask applications) is used with nginx. nginx is a reverse proxy server which acts as a middleman. This helps with load balancing - handling multiples requests efficiently by distributing workloads over the resources. On top of this, supervisor is just used to monitor and control the server processes (gunicorn or uWSGI in our example). From my understanding, the web server that comes with Flask (werkzeug server) is not production ready and should be used for development purposes only.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With