[mod_python] Run mod_python on MacOSX by using DarwinPorts

rtjohan at syspres.com rtjohan at syspres.com
Thu Aug 5 01:42:19 EDT 2004

Hi Everyone, new to this list.

Noticed some discussions about getting mod_python working on MacOSX.

I used the DarwinPorts,  http://darwinports.opendarwin.org/, to install  
mod_python and it installed all the dependencies for me including  
apache2 on a PowerMac G5 running MacOSX 10.3.4. All I did was: "port  
install mod_python" and got: Apache/2.0.49 (Unix) DAV/2  
mod_python/3.1.3 Python/2.3.4.

I just disabled the built-in Apache via the /etc/hostsconfig file.  
There might be some other things I should also do, like modify the  
path, but haven't tried that yet - seems to work without it. If there  
are things I should modify please let me know.

Been using DarwinPorts for a few months and seems to work pretty well.  
Prefer that over Fink since more experience with FreeBSD & their port  
system and DarwinPorts is based on FreeBSD ports to some degree.

Only thing I did after that is to add following to  
LoadModule python_module /opt/local/apache2/modules/mod_python.so

Alias /ais  "/opt/local/apache2/htdocs/ais/"
Alias /ais/ "/opt/local/apache2/htdocs/ais/"
<Directory "/opt/local/apache2/htdocs/ais">
     AddHandler mod_python .psp .psp_
     PythonHandler mod_python.psp
     PythonDebug On
     Options Indexes MultiViews
     AllowOverride None
     Order allow,deny
     Allow from all

DirectoryIndex index.psp index.html index.htm
Good news is, mod_python w/ psp seems to work with the DarwinPorts  
defult build.

The issue I get, might be since I haven't messed with path changes yet:
When I need to modify the httpd.conf file, I can't just use the  
"/opt/local/apache2/bin/apachectl graceful", since will "Internal  
Server Error". But, if reboot the machine, then a valid httpd.conf will  
make mod_python + psp work just fine. Might be some interaction with  
the built-in python/apache.

Here are the details:
Before the graceful restart of apache, when go to login.psp page loads  
fine and access_log shows: - - [04/Aug/2004:23:53:51 -0700] "POST /ais/login.psp  
HTTP/1.1" 200 4700
But after restart and go to page get Internal Server Error and get this  
from access_log: - - [05/Aug/2004:00:24:01 -0700] "POST /ais/login.psp  
HTTP/1.1" 500 650

If reboot machine, this error doesn't occur till I try to restart  
apache again.
The only other way to get passed this error is to comment out:
  #    PythonHandler mod_python.psp
When do a apache restart after this change, the page does load and  
provides errors about psp of-course, but page loads.

So at least it works, although annoying problem. Probably a simple fix  
for this I imagine, just not that knowledgeable with Apache2.

If there is anything further I can do to test or modify please let me  


More information about the Mod_python mailing list