Mod_python

Gensek fusionary_2000 at yahoo.com
Tue May 3 22:22:52 EDT 2005


I want to use mod_python, but I'm having trouble. Here's what I have in
my config:

LoadModule python_module /usr/local/apache2/modules/mod_python.so

<Directory /usr/local/apache2/htdocs/python>
    AddHandler mod_python .py
    PythonHandler mptest
    PythonDebug On
</Directory>

/usr/local/apache2/htdocs/python/mptest.py:

from mod_python import *

def handler(req):
    req.write("Hello")
    return apache.OK


http://localhost/python/mptest.py:

Mod_python error: "PythonHandler mptest"

Traceback (most recent call last):

  File
"/AcivePython-2.4/lib/python2.4/site-packages/mod_python/apache.py",
line 287, in HandlerDispatch
    log=debug)

  File
"/AcivePython-2.4/lib/python2.4/site-packages/mod_python/apache.py",
line 454, in import_module
    f, p, d = imp.find_module(parts[i], path)

ImportError: No module named mptest

Python is obviously binary, but I compiled Apache and modpython. I
restarted apache before using the config. I'm inclined to believe that
I'm doing everything right, but the computer isn't.

Is there any worthwhile alternative to modpython? I find it rather
troublesome.




More information about the Python-list mailing list