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

Emanuel Rumpf x at branwelt.de
Tue Apr 4 15:07:26 EDT 2006


Colin Bean wrote:

>For starters, try putting quotes around the path in the "Directory" section,
>so:
>    <Directory "/anydir/py/">
>
>Also, chage "PythonHandler mod_python.publisher" to "SetHandler
>mod_python.publisher".
>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.
>
>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/']"
>>
>>                #PythonHandler handler_script
>>                PythonHandler mod_python.publisher
>>
>>                PythonDebug On
>>                PythonInterpreter pi01
>>
>>                #excecute those with .py extension
>>                #AddHandler mod_python .py
>>
>>                #excecute those with any extension
>>                #SetHandler mod_python
>>                # the same (?):
>>                SetHandler python-program
>>
>></Directory>
>>
>>
>>Any hints, how to make it working?
>>
>>Thanks,
>>Emanuel
>>
>>
>>btw:
>>What's the diffence between:
>>SetHandler mod_python
>>and:
>>SetHandler python-program
>>
>>    
>>


SetHandler mod_python.publisher
Doesn't seem to work. So maybe the mod_python version is too old? (
mod_python-2.7.11 )

With the following construct, mod_python seems
to create a directory-index (the view changes of the directory list,
that's why I assume it),
but the files still are delivered as plain-text.


<FilesMatch "(.*)">
        Options -FollowSymLinks +Indexes
        Order allow,deny
        Allow from all
       
        #excecute those with .py extension
        #AddHandler mod_python .py
       
        PythonHandler mod_python.publisher
        SetHandler python-program
        PythonDebug On
      
</FilesMatch>

There's a message in /var/log/apache/error.log :
[Tue Apr  4 18:37:57 2006] [notice] mod_python: (Re)importing
mod_python.publisher from None

Emanuel








More information about the Mod_python mailing list