From a completely opposite point of view, Blankman, here is my "Entry Page" for the web services gateway interface:
PART ONE: WEB SERVERS
Web servers serve responses. They sit patiently waiting, and then suddenly without any warning:
- the client process sends a request. The client process can be a web server, bot, mobile application. It is just a "customer"
- web server receives this request
- intentional mumble various things happen (see below)
- The web server sends something to the client
- web server sits again
Web servers (at least the best) are very VERY good at this. They scale up and down depending on demand, they reliably conduct conversations with the brightest customers on truly collapsed networks, and we never have to worry about it. They just continue to serve.
This is my point: web servers are just like that: servers. They donโt know anything about content, nothing about users, nothing but how to wait a lot and respond reliably.
Your choice of web server should reflect your delivery preference, not your software. Your web server should be responsible for the service, not for the processing or logical material.
PART TWO: (PYTHON) SOFTWARE
The software is not sitting. Software exists only at runtime. The software is not very convenient when it comes to unexpected changes in its environment (files are not where they are expected, renamed parameters, etc.). Although optimization should be the main principle of your design (of course), the software itself is not optimized. Developers optimize. The software is running. The software does everything in the "Intentional Mumble" section above. It could be anything.
Your choice or software design should reflect your application, your choice of functionality, and not your choice of web server.
Here, the traditional "language compilation" method for web servers becomes painful. You embed code in your application to cope with the physical server environment, or at least have to choose the appropriate wrapper library to include at runtime to create the illusion of uniformity on all web servers.
SO WHAT IS WSGI?
So finally, what is WSGI? WSGI is a set of rules written in two halves. They are written in such a way that they can be integrated into any environment that welcomes integration.
The first part, written for the web server, says: โWell, if you want to deal with the WSGI application, this is what the software will look like at boot. Here is what you need to make available for the application, and here is the interface (layout) "which you can expect from every application. Moreover, if something goes wrong, thatโs how the application will look and how you can expect it to behave."
The second part, written for the Python application software, reads: โWell, if you want to deal with the WSGI server, this is how the server will think when it contacts you. Here is what you need to make available to the server, and here the interface (layout) that you can expect from each server.Moreover, if something goes wrong, this is how you should behave, and this is what you should tell the server.
So, you have it - the servers will be servers, and the software will be software, and here they can do fine without resorting to any additional advantages with respect to the features of the other. This is the WSGI.
mod_wsgi, on the other hand, is a plug-in for Apache that allows it to talk to WSGI-compatible software, in other words, mod_wsgi is the implementation - in Apache - of the rules of the first part of the above rule.
Regarding CGI .... ask someone else :-)