I"m looking at the WSGI specification and I"m trying to figure out how servers like uWSGI fit into the picture. I understand the point of the WSGI spec is to separate web servers like nginx from web applications like something you"d write using Flask. What I don"t understand is what uWSGI is for. Why can"t nginx directly call my Flask application? Can"t flask speak WSGI directly to it? Why does uWSGI need to get in between them?
There are two sides in the WSGI spec: the server and the web app. Which side is uWSGI on?
Okay, I think I get this now.
Why can"t nginx directly call my Flask application?
nginx doesn"t support the WSGI spec. Technically nginx could implement the
WSGI spec if they wanted, they just haven"t.
That being the case, we need a web server that does implement the spec, which is what the
uWSGI server is for.
uWSGI is a full fledged http server that can and does work well on its own. I"ve used it in this capacity several times and it works great. If you need super high throughput for static content, then you have the option of sticking
nginx in front of your
uWSGI server. When you do, they will communicate over a low level protocol known as
"What the what?! Another thing called uwsgi?!" you ask. Yeah, it"s confusing. When you reference
uWSGI you are talking about an http server. When you talk about
uwsgi (all lowercase) you are talking about a binary protocol that the
uWSGI server uses to talk to other servers like
nginx. They picked a bad name on this one.
For anyone who is interested, I wrote a blog article about it with more specifics, a bit of history, and some examples.
This book introduces machine learning methods in finance. It features a unified treatment of machine learn...
ig Data applications are growing very rapidly around the globe. This new approach to decision making takes into account data gathered from multiple sources. Here my goal is to show how these diverse s...
A Practical Approach to Computer Algorithms Using Python® and C# Rod Stephens started out as a mathematician, but while studying at MIT, he discovered how much fun algorithms are. He took every al...
Topics on Big Data are growing rapidly. From the first 3 V’s that originally characterized Big Data, the industry now has identified 42 V’s associated with Big Data. The list of how we characteriz...