Installing mod_python for Python 2.5 on Mac OS X

Django wants to be served from behind Apache, using mod_python. I want to use Python 2.5, but the MacPorts/DarwinPorts mod_python port wants to use Python 2.4.

I downloaded mod_python 3.3.1 from the mod_python downloads page and was able to install in a few easy steps:

$ ./configure --with-apxs=/opt/local/apache2/bin/apxs
$ make
$ sudo make install
$ sudo vi /opt/local/apache2/conf/httpd.conf

# Add this line
LoadModule python_module /opt/local/apache2/modules/

Then restart the web server.

All of the warnings in the mod_python README about Mac OS X 10.2.x and Python and libtool and static libraries appear not to matter for OS X 10.4.

Testing w. Django

To test the installation I set up a virtual host pointing to my Django app, following the instructions in the Django docs.

The hardest part was realizing I needed a virtual host (the IP address for which I hardwired into my /etc/hosts file). That was the easiest way to let my app continue to use its absolute URL paths; learning how to adapt to different installation "mount points" looked a bit harder.

The next hardest part was putting the subversion workspace for my project where the web server user (www) had permission to traverse to it.