[mod_python] combine psp with publisher woes

km km at mrna.tn.nic.in
Thu Aug 11 09:29:26 EDT 2005


Hi all,
i have tried  the classic example which separates template from logic.
i am using mod_python 3.14 with apache 2.0.54

# template ->  hello.template
<html>
<h1><%= greet %></h2>
</html>

# script hello2.py 
from mod_python import apache, psp
def handler(req):
    tmpl = psp.PSP(req, filename='./hello.template')
    tmpl.run(vars = {'greet': 'world'})
    return  apache.OK
i have placed both hello2.py and hello.template in  /usr/local/apache2/htdocs/test1 dir.

my httpd.config is :

<Directory /usr/local/apache2/htdocs/test1>
SetHandler  mod_python
PythonHandler mod_python.publisher
PythonDebug On
</Directory>

when i run the script hello2.py apache bounces back with error "The requested url /test1/hello2.py was not found on the server "
i intrigued into server error logs but it said "[notice] mod_python (Re) importing module hello2 with path set to '['/usr/local/apache/htdocs/test1']'"
well, it looks like the path is correctly set but somethings wrong .. 

 i have also run this url "http://myhost/test1/hello2.py/handler" on browser but it gave me plain html from hello.template with 'greet' value set to world.

any ideas whats going wrong ? 

regards,
KM




More information about the Mod_python mailing list