Been using mod_python for a while, I read more and more articles about how good WSGI is, without really understanding why.
So why should I switch to it? What are the ben
Most Python frameworks implement wsgi. There is mod_wsgi for apache and a SCGI/FastCGI/AJP module + Flup for the others. That way you can have all the advantages of a separate Python process, without being tied to one webserver.
You shouldn't have to relearn much, since the difference from a developer perspective is just a small wrapper and some server configuration.
From a deployment perspective, the difference is that your python code lives in a separate process from the web browser, which means
a) The python process can be running as another user than the web server. This can be valuable for security, if used right.
b) The web server processes does not need to contain the python runtime. This can be a major boost for performance if the server runs a lot of "other" requests (static files, etc) and some heavy python requests.
mod_wsgi vs. mod_python:
WSGI in general:
[1] - compared to a preforking Apache, which maintains a separate Python interpreter in each process
WSGI is the standard API, which enables you to choose the webserver, and also put A WSGI pipeline such as Repoze in front of it.
See http://repoze.org/
For developing sophisticated web applications in Python, you would probably use a more comprehensive web development framework like DJango, Zope, Turbogears etc. As an application developer, you don't have to worry about WSGI much. All you have to be aware about is that these frameworks support WSGI. The WSGI allows separation of web server and web application code and a system administrator can change the web server as long as the web application is WSGI compliant. If you are developing in one of these frameworks, you would anyway be satisfying this condition.
If you are a web framework developer (that is developing DJango or Zope itself), then you have to understand WSGI in more depth.
Usually, if you have a Web Server like NGINX or Apache, you have to enable modules (although the configuration of modules in both cases are different).
WSGI is a standard described on PEP 3333 and basically, provides a standard interface between web applications written in Python and Webservers.
That means, WSGI gives portability to your Python Web Application across many different Web Servers, without any additional configurations on your NGINX, Apache, etc.
Besides that, a WSGI server can give you a lot of functionalities with more flexibility, in comparison with a Web Server. Gunicorn, provides a lot of features like:
Here is a complete document about the options supported by Gunicorn.
As System Administrator, you don't need to understand every detail about the standard but as Software Developer, you may need to understand a little bit more, than just doing pip install gunicorn
and so on.