Getting mod_python to Work
jpuopolo
puopolo at gmail.com
Tue Aug 5 10:33:14 EDT 2008
On Aug 5, 8:44 am, jpuopolo <puop... at gmail.com> wrote:
> Hi, all...
>
> I am hoping that someone can help me with the magic incantation to get
> mod_python working on my local machine.
>
> Set up: Apache 2.2.9, mod_python 3.3.1 on Windows Vista (yes, pity
> me).
>
> I've gotten the basic mptest.py handler to work with no problem. I am
> now trying to use the mod_python.publisher, but when I do, I get a 404
> Not Found error for any file I try to access. If I switch back to my
> simple mptest,py handler, everything works fine.
>
> What do I need to do so that I can use the mod_python.publisher?
>
> Here is the relevant section from my httpd.conf file:
>
> LoadModule python_module modules/mod_python.so
> <Directory "C:\Program Files\Apache Software Foundation\Apache2.2\cgi-
> bin/">
> AddHandler mod_python .py
> #PythonHandler mptest --- works if I uncomment this line and comment
> next line
> PythonHandler mod_python.publisher
> PythonDebug On
> </Directory>
>
> Many thanks,jpuopolo
All:
As it turns out, it was the URL I was using that made the difference -
and the URL that worked was http://localhost/cgi-bin/helloworld.py/handler
Note the /handler at the end of the URL --- this made all the
difference.
I found the answer here: http://mohitsuley.wordpress.com/2008/07/31/my-mod_python-101/
So, in summary, to have mod_python work:
1. Add the following to your httpd.conf file:
#Start of section pasted in by YOURNAME
LoadModule python_module modules/mod_python.so
<Directory "C:\Program Files\Apache Software Foundation\Apache2.2\cgi-
bin/">
AddHandler mod_python .py
PythonHandler mod_python.publisher
PythonDebug On
</Directory>
#End of section pasted in by YOURNAME
I put this at the end of the other LoadModule entries in the
httpd.conf file.
2. Save your httpd.conf file.
3. Restart Apache (either close/restart or restart the Windows
service, depending on your configuration).
4. Ensure the URL to your .py files in your cgi-bin directory (or
whatever directory you've configured, see above) end in /handler
I hope this helps someone...
Thank you,
jpuopolo
More information about the Python-list
mailing list