Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why use uWSGI and supervisor with a Flask app, and not just supervisor?

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?

like image 753
mackwerk Avatar asked May 08 '14 16:05

mackwerk


Video Answer


1 Answers

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.

like image 51
hil Avatar answered Oct 01 '22 13:10

hil