[mod_python] Newbie problem

Gandalf gandalf at geochemsource.com
Fri May 7 07:46:00 EST 2004

Hi All!

I'm totally newbie to mod_python but not to Python itself. Here is my 
server signature:

Apache/2.0.48 (Unix) PHP/4.3.4 mod_python/3.0.3 Python/2.3.3 
mod_ssl/2.0.48 OpenSSL/0.9.7c Server at arwen.msnet Port 80

This is what I have in httpd.conf:

LoadModule python_module libexec/apache2/mod_python.so
AddHandler mod_python .py
AddType applcation/x-http-python .py

<Directory />
 PythonHandler index
 PythonDebug On

This is what I have in index.py (BTW it was taken from the mod_python 
http://www.modpython.org/live/current/doc-html/tut-what-it-do.html ):

from mod_python import apache

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

Finally, the server starts OK, and when I try to GET this URL:


then I get a plain/text file containing my Python code. It seems that 
the handler does not work (simply downloads the file).
I tried to use this too:

PythonHandler mod_python.publisher

and return the string "Hello World!" in the function but it did not work 
either. What did I wrong?

Thanks in advance,


More information about the Mod_python mailing list