[mod_python] mod_python tutorial issues

Nilesh Govindrajan admin at itech7.com
Mon Mar 17 10:40:38 EDT 2008


Joseph Sliz wrote:
>
> I am new to mod_python and Apache.
>
> My environment is:
>  
> Windows XP Prof sp2
> Python 2.4
> Apache 2.2.8
> Mod_python 3.3.1
>  
> I’ve already added the following to the Apache httpd.conf
>  
> LoadModule python_module modules/mod_python.so
>  
> I’m now trying to do a simple test, following a tutorial I found.  I’ve also added the following to the Apache httpd.conf file to let Mod_python know where to find my python module
>  
> DocumentRoot /C:/temp
> <Directory /C:/temp>
>     AddHandler python-program .py 
>     PythonHandler hello
> </Directory>
>  
>  
> I have added the following python script to my “C:/temp” directory.
>  
> from mod_python import apache
>  
> def handler(req):
>      req.content_type = "text/plain"
>      req.send_http_header()
>      req.write("Hello, Welcome to my World!")
>      return apache.OK
>  
>  
> When I put the request “http://localhost/hello.py” into my browser, I receive an “HTTP 404 Not Found” error.  Can anyone please give me some assistance as to what I might be doing wrong??
>  
> Reqards……Joe
>  
> / /
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python
>   
Try with

AddHandler mod_python .py

and

SetHandler mod_python

note: you must AddHandler first otherwise it won't work.


More information about the Mod_python mailing list