[mod_python] ImportError issue

Reuben A Christie christie at knewco.com
Wed Dec 3 07:51:49 EST 2008

Hi all, I am pretty novice user of mod_python. and there is an issue 
that I am experiencing with mod_python scripts for past 2 days that I am 
not able to solve.

my directory structure is as following,

DocumentRoot :  /usr/local/apache2/htdocs/
i have a directory structure for mod_python scripts under DocumentRoot is,

in apache config, i have added following

<Directory /usr/local/apache/htdocs/python_test >
        AllowOverride All
        Order allow,deny
        allow from all      
        AddHandler mod_python .py
        PythonHandler launch
        PythonDebug On

and launch.py looks like this,

import os.path
from mod_python import apache, Session, util

def handler(req):
        request = os.path.splitext(os.path.basename( req.uri ))[0]
        req.content_type = 'text/plain'

        status = apache.OK
        if request != None:
                mod = __import__(request)
                if request == "test1":
                        status = mod.handler(req)
         return status
basically this script should act as gateway for rest of the python scripts .

when I test it with, http://localhost/python_test/test1.py it does not 
work (i get Not found message) and if I do 
http://localhost/python_test/p1 i get the source code of the script appear.

please help
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3316 bytes
Desc: S/MIME Cryptographic Signature
Url : http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20081203/04db0be3/smime.bin

More information about the Mod_python mailing list