Install mod_python
Nancy
wxling3 at hotmail.com
Sat Jul 17 23:55:54 EDT 2004
Hi,
I am new to python. I am trying to install mod_python in my
computer(WinXP Pro, Apache 2.0.50, python2.3.4). I added the following
statements in my Apache configuration file httpd.conf
<Directory "C:/Apache Group/Apache2/htdocs/python">
AddHandler python-program .py
PythonHandler myscript
</Directory>
LoadModule python_module modules/mod_python.so
And restart my Apache. edit myscript.py as following and put the file
in the directory of C:/Apache Group/Apache2/htdocs/python/,
from mod_python import apache
def handler(req):
req.content_type = "text/plain"
req.send_http_header()
req.write("Hello World!")
return apache.OK
but it gives following error message:
The server encountered an internal error or misconfiguration and was
unable to complete your request.
The error.log shows as,
[Sat Jul 17 23:26:37 2004] [error] [client 127.0.0.1] PythonHandler
myscript: Traceback (most recent call last):
[Sat Jul 17 23:26:37 2004] [error] [client 127.0.0.1] PythonHandler
myscript: File "C:\\Python23\\Lib\\site-packages\\mod_python\\apache.py",
line 287, in HandlerDispatch\n log=debug)
[Sat Jul 17 23:26:37 2004] [error] [client 127.0.0.1] PythonHandler
myscript: File "C:\\Python23\\Lib\\site-packages\\mod_python\\apache.py",
line 457, in import_module\n module = imp.load_module(mname, f, p,
d)
[Sat Jul 17 23:26:37 2004] [error] [client 127.0.0.1] PythonHandler
myscript: File "C:/Apache
Group/Apache2/htdocs/python/\\myscript.py", line 2
[Sat Jul 17 23:26:37 2004] [error] [client 127.0.0.1] PythonHandler
myscript: def handler(req):
[Sat Jul 17 23:26:37 2004] [error] [client 127.0.0.1] PythonHandler
myscript: ^
[Sat Jul 17 23:26:37 2004] [error] [client 127.0.0.1] PythonHandler
myscript: SyntaxError: invalid syntax
Who could give me some hints? Thanks a lot!
Nancy Wang
More information about the Python-list
mailing list