By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,186 Members | 1,620 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,186 IT Pros & Developers. It's quick & easy.

Getting mod_python to Work

P: n/a
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

Aug 5 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On Aug 5, 8:44*am, jpuopolo <puop...@gmail.comwrote:
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...od_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
Aug 5 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.