[mod_python] Re: mod_python on Windows

Bill Eldridge bill at rfa.org
Mon Jun 23 14:39:55 EST 2003

Peter Brown wrote:

>// Okay, it loads with 2.2.3, but I'm getting the ImportError: No module
>// named _apache
>// from my cgi-bin (when run from within Apache, *NOT* from the the command
>//l ine.
>// Any idea what PYTHONPATH, PATH, etc. might help it find _apache? (which
>// I assume should be loaded from the c:\Program Files\Apache
>// Group\Apache2\modules dir,
>// with the LoadModule python-module modules/mod_python.so  directive, but
>// doesn't
>// seem to be).
>With 2.2.3 now I can get Apache to load mod_python.so successfully, and even
>got the ole fave "Hello World" to work a few times.
>Now when I run it mod_python loads OK but I get the following error: I guess
>some changes I made to the Apache config file caused the problem. Buggered
>if I know what. So if anyone has any ideas I will be more than welcome to
>hear them.

You should only need something in your <directory cgi-bin> like:
<Directory "C:/Program Files/Apache Group/Apache2/cgi-bin">^M
    AllowOverride None^M
    Options None^M
    Order allow,deny^M
    Allow from all^M
    AddHandler python-program .pys
    PythonHandler myhandler
    PythonDebug On
<directory "c:/Program Files/Gpache Group

which will send anything to a name (existing or not) like "bill.pys"
off to cgi-bin/myhandler.py

(my guess is you messed up the AddHandler or PythonHandler statements)

I also had some luck doing this with Python 2.3, but made some changes
and never made it back to Kansas. Basically, I was just binary editing
the DLL and changing the one occurence of python22.dll to python23.dll.
Mostly caused no harm :()

More information about the Mod_python mailing list