[mod_python] H-sphere and Mod_python

Jim Gallacher jpg at jgassociates.ca
Sun Nov 5 12:11:41 EST 2006


Wyatt Neal wrote:
> Has anyone been able to get mod_python-2.7.11 to work with h-sphere's apache
> 1.3.37?  I've been having a devil of a time.  From the logs I can see that
> mod_python is actually being loaded.  
> 
>>From the httpd.conf:
> ...
> ...
> #LoadModule scoreboard_send_module libexec/mod_scoreboard_send.so
> #LoadModule extract_forwarded_module libexec/mod_extract_forwarded.so
> #LoadModule gzip_module        libexec/mod_gzip.so
> LoadModule perl_module        libexec/libperl.so
> LoadModule python_module      libexec/mod_python.so
> ...
> ...
> ...
> #AddModule mod_scoreboard_send.c
> #AddModule mod_extract_forwarded.c
> #AddModule mod_gzip.c
> AddModule mod_perl.c
> AddModule mod_python.c
> 
>>From the site specific configuration file:
> 
> ...
> <DIRECTORY /hsphere/local/home/htglimit/trac.htglimited.com>
> AddHandler python-program .py
> OPTIONS  Indexes ExecCGI FollowSymLinks
> AllowOverride All
> </DIRECTORY>
> IndexOptions FancyIndexing
> 
> </VirtualHost>
> 
> Using the test.py program that looks like this:
> 
> from mod_python import apache
> def handler(req):
>         req.content_type = "text/plain"
>         req.send_http_header()
>         req.write("Hello World!")
>         return apache.OK
> 
> Permissions are correct, and yet every time, I get just the text back on the
> screen.  Can anyone shed some light on this?

Looks like you are missing the PythonHandler directive. eg.

AddHandler python-program .py
PythonHandler test

But I wouldn't use test.py as your handler name, as there is test module 
  in the python std library so things may get messed up. Better off with 
mptest.py

Jim





More information about the Mod_python mailing list