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.
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 no changes to the code (in most cases).