some problems with mod_python

Bruno Desthuilliers bdesth.quelquechose at free.quelquepart.fr
Fri Aug 24 09:39:26 EDT 2007


Johan a écrit :
> Hi
> 
> I have installed and tested this on centos, fedora and freebsd all
> give the same problem so I guess I missed some steps.
> 
> I have compiled bot apache (2.2.4) and mod_python (3.3.1) according to
> the docs and no problem with this.
> But when I have made everything about testing mod_python an browse to
> http://server/test and there expecting to see "Hello world" I instead
> get an index of contents in this directory. If I go to  http://server/test/mptest.py
> it works. No errors in any log either.
> 
> What Have I missed?

The difference between AddHandler and SetHandler in apache's conf.

> This I added to httpd.conf
> <Directory /opt/site/htdocs/test>
>         AllowOverride All
>         AddHandler mod_python .py
>         PythonHandler mptest
>         PythonDebug On
> </Directory>

Your problem is with Apache configuration, not with mod_python. The 
AddHandler directive maps <dirpath>/*.py to your handler. So you have to 
call <anythinghere>.py to trigger the desired behaviour. If you want 
*any* url under <dirpath> to be handled by mptest, you need to use 
SetHandler, not AddHandler.



More information about the Python-list mailing list