1.15.1.4 Running WSGI Applications

The Python web modules come with two solutions for running WSGI applications, a WSGI server and a runCGI() middleware component allowing WSGI applications to be run from CGI scripts on servers such as Apache.

Note: It much faster to execute WSGI applications through a dedicated WSGI server than to run them as CGI scripts. When a CGI script is executed all the Python libraries and modules the script uses need to be loaded into memory and then removed once the script exists. This has to happen for every request so there is an unecessary delay before the WSGI application is even executed. When using a WSGI server the libraries and modules only need to be loaded once and are then available for any subsequent requests so simple web requests can be handled perhaps 5-10 times faster.