some problems with mod_python

Graham Dumpleton Graham.Dumpleton at gmail.com
Tue Aug 28 00:12:50 CEST 2007


On Aug 28, 6:13 am, Johan <val... at gmail.com> wrote:
> 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 tohttp://server/testand 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?
>
> This I added to httpd.conf
> <Directory /opt/site/htdocs/test>
>         AllowOverride All
>         AddHandler mod_python .py
>         PythonHandler mptest
>         PythonDebug On
> </Directory>
>
> this is my mptest.py:
> from mod_python import apache
>
> def handler(req):
>         req.content_type = 'text/plain'
>         req.write("Hello World!")
>         return apache.OK
>
> /johan

You need to look at the Apache documentation for the difference
between AddHandler and SetHandler directives. If you don't want to
read the Apache documentation and learn more about it, at least read:

http://www.dscpl.com.au/wiki/ModPython/Articles/SetHandlerVersusAddHandler

Graham





More information about the Python-list mailing list