First download the following package file, which is licenced under the GPL.
There are a few steps for a successful installation:
Be aware that due to the lack of recent package releases of mod-python an Apache 2.0x server is required, otherwise the shared object link library (.so) cannot resolve all addresses which are required to meet recent Apache .so interface specifications !
There are a few steps for a successful installation:
Be aware that due to the lack of recent package releases of mod-python an Apache 2.0x server is required, otherwise the shared object link library (.so) cannot resolve all addresses which are required to meet recent Apache .so interface specifications !
- Download the register.py file from here and put it in the one python-application-directory, which is intended to be registered (this will also allow using any 2.x Portable Python version). Open a command line and execute register.py
- From the zip file, copy the apache folder into your apache server directory, and the lib folder into your registered Python application directory.
- unpack setup.py and execute it (double click). When a location-request pops up, select your apache directory.
- Add to your httpd.conf (Apache/conf directory) the following line:LoadModule python_module modules/mod_python.sog
- in your ScriptAlias / CGI section of httpd.conf add:
<Directory "<Your Document Root>/python">
AddHandler python-program .py
PythonHandler mptest
PythonDebug on
</Directory> - a sample program (with the extension .py in your www directory) may look like this:
from mod_python import apache
def __main__():
req.content_type = "text/plain"
req.send_http_header()
req.write("Text output via apache CGI.")
return apache.OK
That's it. You can visit modpython.org for general information. The last release was almost 5 years ago.
You may also visit https://www.webwareforpython.org/ for a more recent project, which is based on Python, and includes support for many recent web technologies like JSON. A python based web server is already included.