[mod_python] mod_python test

Graham Dumpleton grahamd at dscpl.com.au
Wed Feb 23 20:35:52 EST 2005


You are using 2.7.10 but appear to be following 3.1.3 documentation.
Use the correct documentation, it will not work otherwise.

Ales Zemene wrote ..
> edited /home/ales/public_html/ice/python/test.py
> ( directory /home/ales/public_html/ice/python/ is normaly visible on net)
> 
> from mod_python import apache
> def handler(req):
>         req.write("Hello World!")
>         return apache.OK

Use:

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


> httpd.conf :
> 
> <Directory /home/ales/public_html/ice/python/test.py>
>    AddHandler mod_python .py
>    PythonHandler mptest
>    PythonDebug On
> </Directory>

The path is wrong, your the handler name wrong and 3.1.3 name is used
on AddHandler. Instead use:

<Directory /home/ales/public_html/ice/python>
   AddHandler python-program .py
   PythonHandler test
   PythonDebug On
</Directory>

> restarted apache, error log:
> 
> <snip>
> [Thu Feb 24 02:01:28 2005] [notice] Apache/1.3.33 (Debian GNU/Linux)
> mod_python/2.7.10 Python/2.3.4 PHP/4.3.10-2 configured -- resuming
> normal operations
> [Thu Feb 24 02:01:28 2005] [notice] suEXEC mechanism enabled (wrapper:
> /usr/lib/apache/suexec)
> [Thu Feb 24 02:01:28 2005] [notice] Accept mutex: sysvsem (Default:
> sysvsem)
> </snip>
> 
> any idea what is missing?


More information about the Mod_python mailing list