LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-11-2006, 09:08 PM   #1
BrianK
Senior Member
 
Registered: Mar 2002
Location: Los Angeles, CA
Distribution: Debian, Ubuntu
Posts: 1,334

Rep: Reputation: 51
mod python: What to use for PythonHandler in apache2.conf?


I'm trying to get apache2's modpython working. I've installed mod_python & added the following lines to my apache2.conf:

AddHandler mod_python .py
PythonHandler mod_python.publisher
PythonDebug On


Is this correct? What is mod_python.publisher? How do I know if I have it?

If I look at my apache2 error log, I see these lines every time I try to access the python script through a browser:

[Wed Oct 11 18:59:36 2006] [notice] mod_python: (Re)importing module 'mod_python.publisher'
[Wed Oct 11 18:59:36 2006] [notice] mod_python: (Re)importing module 'example1' with path set to '['/job/drqueue/python/examples ']'


... and then the page comes up as a 404. ??
 
Old 10-10-2007, 05:24 PM   #2
BrianK
Senior Member
 
Registered: Mar 2002
Location: Los Angeles, CA
Distribution: Debian, Ubuntu
Posts: 1,334

Original Poster
Rep: Reputation: 51
if anyone else comes across this same problem, here's the deal:

the above is correct - kindof.

It assumes there's some built-in python module called "publisher". As of the mod_python I just built v3.3.1, that doesn't exist. There is, however, a built-in called "testhandler" that will spit back a lot of python info, kinda like phpinfo() in php if you're familiar. Otherwise, you can just enter in the name of your script (minus the .py) to test.

So, if you make a hello world mod_python program called "hello.py" in /local/htdocs/python, the test config for apache would look like:

Code:
<Directory "/local/htdocs/python"> 
   AddHandler mod_python .py
   PythonHandler hello
   PythonDebug On 
</Directory>
... or if you want a lot of generic python config info, change the above to:

Code:
<Directory "/local/htdocs/python"> 
   AddHandler mod_python .py
   PythonHandler mod_python.testhandler
   PythonDebug On 
</Directory>
Either way, go to http://localhost/python/hello.py to see the output. For the former, it will should just spit out "hello world" (assuming your program is written correctly), for the latter it will spit out a giant table of info. If you get an internal server error message, something else is wrong.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
whereis apache2-mod-php barrythai SUSE / openSUSE 0 08-30-2005 01:59 PM
[Debian] Mod-python not working freek sanders Debian 5 06-30-2005 04:35 PM
apr-mod apache2 Skaan Debian 2 05-27-2005 04:29 AM
Need help compiling mod perl with apache2 unixmad Linux - Software 0 08-25-2004 06:34 AM
how do i install mod perl with apache2 unixmad Linux - Newbie 2 08-22-2004 12:00 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:39 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration