[mod_python] My mod_python configuration woes...

Amy G amy-g-art at cox.net
Wed Mar 24 23:16:34 EST 2004


Mod_python version -- 2.7.9, 2.7.10
Os -- FreeBSD 5.1
Python 2.3
Apache 1.3.7


I successfully ran
./configure --with-apxs=/usr/local/apache/sbin/apxs

I then ran
make dso

Then
make install

Everyting completed successfully and the make install output message told me
what lines to add to my httpd.conf.

I did so adding...

LoadModule python_module      libexec/apache/mod_python.so
AddModule mod_python.c

<Directory /usr/local/www/data-dist/python>
    AddHandler python-program .py
    PythonHandler example
    PythonDebug On
</Directory>

I also had to add
LD_PRELOAD=/usr/lib/libc_r.so
export LD_PRELOAD
to my environment.

The directory /usr/local/www/data-dist/pthon is viewable on the internet.
But, the file still shows up as text output to the browser window.
The program example.py is as follows.

#!/usr/local/bin/python

from mod_python import apache

def handler(req):
    req.content_type = "text/plain"
    req.write("Hello World!")
    return apache.OK



Any ideas.  I love the programming power of python and would like to start
writing some cgi scripts of my own.

Thanks.



More information about the Mod_python mailing list