[mod_python] Installig mod_python on Win XP.

Oyvind Ostlund Oyvind.Ostlund at cern.ch
Fri May 20 05:10:37 EDT 2005


I tried to follow the steps on this site:
http://www.xminc.com/linux/mod_python1.html

But I can't get it to work. I installed Apache 2.0.54, and I have Python 2.3.5 installed. Then I installed mod_python 3.1.3. And I added this to the Apaches httpd.conf file: 

---------------------
LoadModule python_module modules\mod_python.so

<Directory "c:\Apache2\htdocs\python">
    AddHandler mod_python .py
    PythonHandler mptest
    PythonDebug On
</Directory>
---------------------

Not sure if I added it the right place, but at least I managed to restart Apache afterwards. Then I made a simple python script like this:

---------------------
from mod_python import apache

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



But if I go to http://localhos/python/ then I get this error message:



---------------------
Mod_python error: "PythonHandler mptest"

Traceback (most recent call last):

  File "C:\PYTHON~1\Lib\site-packages\mod_python\apache.py", line 287, in HandlerDispatch
    log=debug)

  File "C:\PYTHON~1\Lib\site-packages\mod_python\apache.py", line 457, in import_module
    module = imp.load_module(mname, f, p, d)

  File "C:/Apache2/htdocs/python/\mptest.py", line 3

    def handler(req):

    ^

SyntaxError: invalid syntax
---------------------


Does this have anything to do with me not compiling the apache server from scratch with DSO or something. I found some reading about it, at least for Linux, but I have never heard about it before. So is that probably the error, or is it simpler then that?


Thanks
Øyvind Østlund



More information about the Mod_python mailing list