1.2 Flexibility

Mod_python allows for a level of functionality beyond the reach of CGI scripts.

Apache processes requests in phases (e.g. read the request, parse headers, check access, etc.). These phases can be implemented by functions called handlers. Traditionally, handlers are written in C and compiled into Apache modules. Mod_python provides a way to extend Apache functionality by writing Apache handlers in Python. For a detailed description of the Apache request processing process, see the Apache API Notes, as well as the Mod_python - Integrating Python with Apache paper.

For most programmers, the request and the authentication handlers provide everything required.

To ease migration from CGI, a standard mod_python handler is provided that simulates the CGI environment allowing a user to run legacy scripts under mod_python with (for the most part) no changes to the code.

See Also:

http://dev.apache.org/
Apache Developer Resources
http://www.modpython.org/python10/
Mod_Python - Integrating Python with Apache