This version of www.jasonlam604.com is deprecated.
If you are not redirected to the new web site in 3 seconds, please click on the following link
http://www.jasonlam604.com/v2/index.php
 

 


Configure mod_python with Apache on Windows
by Jason Lam

Step 1:

Assuming you have Python and Apache installed already go and download mod_python from http://www.modpython.org/


Step 2:

Extract and place the mod_python.dll in modules sub directory where apache is installed ie: c:\program files\apache group\apache\modules


Step 3:

Modify the http.conf file, add to the Dynamic Shared Object section the following:
LoadModule python_module modules/mod_python.dll


Step 4:

Add to the ScriptAlias the following:
<Directory "<Your Document Root>/python">
AddHandler python-program .py
PythonHandler apache
PythonDebug on
</Directory>


Step 5:

Create Test file name helloworld.py store in /python directory (/python directory should be created directly under the document root ie: htdocs/python) with the following content:
from mod_python import apache

def handler(req):
req.content_type = "text/plain"
req.send_http_header()
req.write("Hello World!")
return apache.OK


Step 6:

Restart Apache and point to the newly created file, you should see the Hello World output


 

 

 

| Home | Tutorials | Tips / Hints | Books | Links |
| Resume | Portfolio | Services | Contact |

The contents of this webpage are copyright © 2003 - 2006
Jason Lam All Rights Reserved