[mod_python] questions about mod_python publisher

Jorey Bump list at joreybump.com
Wed May 19 16:57:17 EDT 2004


David Geller wrote:

> I have had the same experience as Terry.
> 
> However, I just tried something and it worked!
> 
>  <Directory /www/docroot>
>       PythonInterpreter myapp2
>     PythonPath "blahblabh
>     SetHandler python-program
>     PythonHandler mod_python.publisher
>     PythonDebug On
>   </Directory>
> 
> i.e., use "SetHander python-program" with no following argument ".py", 
> followed by "PythonHandler with arg of mod_python.publisher"

Hmmm, then *every* file needs to be a python program. You can't mix 
html, php and image files. You might as well just run python apps from 
cgi-bin.

This is an interesting problem. With these directives in httpd.conf:

<Directory /var/www/documentroot>
   AddHandler python-program .py
   PythonHandler mod_python.publisher
   PythonDebug On
</Directory>

And assuming my app is test.py:

def hello(req):
     x = "Hello, world!"
     return x

I can access it on my Debian Woody production server (apache 1.3.26, 
mod_python 2.7.8) like this :

  http://www.example.com/test/hello

But on my Red Hat 9 server (apache 2.0.40, and mod_python 3.0.1-4), I 
need the extension:

   http://www.example.com/test.py/hello

If I change the AddHandler directive to:

   SetHandler python-program

I MUST access it without the extension, but all files in the directory 
are treated as python programs. This seems less flexible to me. I can't 
simply turn on mod_python for the entire site, as I do now. Is this the 
result of a change in apache or mod_python?








More information about the Mod_python mailing list