Install mod_python

vincent wehren vincent at visualtrans.de
Sun Jul 18 09:08:11 CEST 2004


Nancy wrote:

> Hi,
>  I am new to python. I am trying to install mod_python in my
> computer(WinXP Pro, Apache 2.0.50, python2.3.4). I added the following
> statements in my Apache configuration file httpd.conf
> 
> <Directory "C:/Apache Group/Apache2/htdocs/python">
>     AddHandler python-program .py
>     PythonHandler myscript
> </Directory>
> 
> LoadModule python_module modules/mod_python.so
> 
> And restart my Apache. edit myscript.py as following and put the file
> in the directory of C:/Apache Group/Apache2/htdocs/python/,
> 
> from mod_python import apache
>  def handler(req):
>   req.content_type = "text/plain"
>   req.send_http_header()
>   req.write("Hello World!")
>  return apache.OK
> 
> but it gives following error message:


Looks you got your indentation wrong. What happens if you try the 
following instead:

from mod_python import apache

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





More information about the Python-list mailing list