[mod_python] processing py-scripts with apache 1.3 and mod_python

Graham Dumpleton grahamd at dscpl.com.au
Tue Apr 4 17:04:44 EDT 2006

On 05/04/2006, at 2:32 AM, Colin Bean wrote:

> For starters, try putting quotes around the path in the "Directory"  
> section, so:
>     <Directory "/anydir/py/">

Adding quotes should make no different. Quotes are only really required
where path has space or other magic characters in it.

> Also, chage "PythonHandler mod_python.publisher" to "SetHandler  
> mod_python.publisher".

This is an incorrect suggestion as well.

> Once you've done this, I don't beleive that you need the PythonPath  
> directive (since it is the same path as the publisher directory),  
> nor the "SetHandler python-program".
> This doesn't really answer your question in depth, but I beleive  
> that the "SetHandler python-program" directive is only necessisary  
> in older versions(?) of mod_python, in which case you also needed  
> to specify a "PythonHandler" directive.  In your case, the line  
> "SetHandler mod_python.publisher" should be all that's needed.

He is using an older version so must use "python-program". Note that  
still works in newer versions as well.

> Also, posting relevant snippets of your error logs will help us to  
> diagnose further problems.
> HTH,
> -Colin
> On 4/4/06, Emanuel Rumpf <x at branwelt.de> wrote: Hello,
> I wanted /anydir/py/test.py to be processed by mod_python
> on apache 1.3 server, when requesting http://domain.org/py/test.py
> (where /anydir/ is the DocumentRoot)
> No matter, what I tried, there was no success,
> either the file was delivered as textfile-download,
> or I got a "File not Found" error.
> my current config, which is inside a virtual host:
> <Directory /anydir/py/>
>                 Options -FollowSymLinks +Indexes
>                 Order allow,deny
>                 Allow from all
>                 PythonPath "sys.path+['/anydir/py/']"

No necessary to have PythonPath.

>                 #PythonHandler handler_script
>                 PythonHandler mod_python.publisher
>                 PythonDebug On
>                 PythonInterpreter pi01
>                 #excecute those with .py extension
>                 #AddHandler mod_python .py

This should be:

   AddHandler python-program .py

The "mod_python" tag only works in newer versions of mod_python.

>                 #excecute those with any extension
>                 #SetHandler mod_python
>                 # the same (?):
>                 SetHandler python-program

Don't use SetHandler, use the AddHandler line above instead else every
request will go through mod_python and you will not be able to serve
up static files.

> </Directory>
> Any hints, how to make it working?
> Thanks,
> Emanuel
> btw:
> What's the diffence between:
> SetHandler mod_python

Works in mod_python 3.X.

> and:
> SetHandler python-program

Works in mod_python 2.7.X and 3.X.

Having done that, if you still can't get it to work, post the  
contents of your
"test.py" file.

BTW, it is bad to call it "test.py" as there is a Python module  
called "test"
and so if you stuff up, it may pick that up instead.

Although not for mod_python.publisher, would suggest you read:



More information about the Mod_python mailing list