A framework for WebProgramming.
stable version for Apache 1.*: 2.7.10 (2004-01-22)
stable version for Apache 2.*: 3.2.8 (2006-02-24)
Python versions: Python 1.5.2, 1.6, 2.0, 2.1, mod_python 3.* requires 2.2.1
licence: The Apache Software License, Version 1.1
Linux and Windows. RPMs available.
mod_python can be used to develop fast and small web tools and applications, and as part of larger custom application frameworks. It provides an object publishing mechanism similar to (but much simpler than) Zope, and a very clean mapping from URLs to functions. This makes it especially suitable for building web-accessible libraries using HTTP GET/POST as function call serialization.
See the mod_python mailing list.
ModPython Compatible Web Application Frameworks
ModPython now has built-in support for cookies and sessions, PSP templates, etc., and a CGI handler for compatibility with regular CGI python scripts.
Web application frameworks that support multiple kinds of deployments including ModPython:
Quixote is a web application framework that has a ModPython handler.
Albatross applications can be deployed to ModPython or CGI.
Karrigell is meant primarily for running small standalone web applications, but now has a ModPython handler as well.
Frameworks designed specifically for ModPython:
PyWork is a Model-View-Controller framework with similarities to Struts.
JOTWeb also separates the view and the model in part by using TAL templates.
Django runs in stand-alone mode for development purpose, but relies on ModPython for production.
mod_python provides a similar API to mod_perl, allowing low-level access to Apache's request handling mechanisms.
Session, Identification and Authentication
mod_python 3.1.3 and later provides support for server-side sessions with memory or dbm-based storage. It also supports session locking. For earlier versions, JonsPythonModules implement session management as well as templating and database pooling. mod_python has a very straightforward and flexible system for basic authentication, allowing access rules to be configured at the module and function level.
Scripts remain in memory between page loads. The Python interpreter can be configured to run per-site or per-directory, allowing the scope of the persistence to be limited as necessary.
mod_python provides a php-like built-in templating system called Python Server Pages (PSP), but there are many others that can also be used (Cheetah for example).
mod_python is an Apache module that embeds the Python interpreter within the server. With mod_python you can write web-based applications in Python that will run many times faster than traditional CGI and will have access to advanced features such as ability to retain database connections and other data between hits and access to Apache internals.
mod_python has been "donated" to the Apache Software Foundation. Here is author Gregory Trubetskoy's official statement as of Thursday, Sept. 12, 2002:
It is my pleasure to announce that Mod_Python has been donated to the Apache Software Foundation, and is now a subproject of the httpd server project (see http://httpd.apache.org/).
I am grateful to ASF for accepting this donation and committing resources to further the support of Mod_Python. I believe that this action will advance the development of Mod_Python, resulting in an ultimately better and more popular tool for Python developers. I also believe it will serve to better position Python as a language of choice for web development, a need that has been expressed by many.
There are no implications to the current Mod_Python users - the license is the same with the sole difference in that the copyright belongs to ASF now.
As a consequense of the donation, the CVS repository is now hosted on cvs.apache.org. Do not use the SourceForge repository anymore, it will soon be removed.
There will also be website and mailing changes, but the details are still being finalized and will be announced when ready.
Modpython Tutorial - An introduction to modpython's high level handlers: Publisher and PSP.