Mod_python

G

Gensek

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, 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.
 
G

grahamd

Gensek said:
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.

Try following through the directions/hints in:

http://www.dscpl.com.au/projects/vampire/articles/modpython-001.html

A lot of the time people cannot get it working because they use the
instructions for mod_python 3.1.X when they actually have 2.7.X
installed. The newer instructions will not work on the older version.

Anyway, even if you will not follow the steps shown in the article,
you can use the hints in it as to what to look for and where.

BTW, best place to talk about mod_python is the mod_python mailing
list.

Graham
 
D

Dan

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

I've been using cherrypy (cherrypy.org) instead of apache with
mod_python. In a lot of cases, apache is overkill. With cherrypy you
can build a web application with a built in web server. It might be
worth a look, it's reasonably easy to use.

Dan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,058
Latest member
QQXCharlot

Latest Threads

Top