The quest for MacOSX 10.5, Apache, Python, Django, and mod_wsgi

Posted by Andy on October 02, 2009
Computers, Internet, Software Development / 4 Comments

It all started when I decided to learn the Django web framework for Python.  I ran through a bunch of examples on the Django site, and in the book Practical Django Projects, Second Ed. and was overall really impressed with the framework and the provided tools.  It has a lot of really useful features, and makes web development a lot of fun.  During my “evaluation” of Django, I was testing everything using the out-of-the-box dev web server that comes with Django, but I eventually came to the point where I wanted to try to host a Django site “for real” in Apache.  I checked the Django deployment documentation, and decided to try to get the suggested mod_wsgi module setup in my local Apache web server, on my Mac Mini (version 10.5.8 – “Leopard”).

At that time (a few hours ago), I was using the default install of python that came with my Mac Mini: version 2.5.1.  I thought it would be a good idea to download and install the latest version of Python (at least the latest 2.x version, as the 3.x versions are still not fully supported by most Python toolkits), so I could be on the bleeding edge.  Little did I know that the latest version 2.6.3 was being released as I spoke (Oct 2)!  I went to download the 2.6.3 version, and found that the MacOSX .dmg download link was broken on the Python download page.  (This will probably be fixed by the time anyone reads this, but this link was throwing a 404 error when I tried!).  Since the .dmg was not available, I had to give up on the “easy route.”  The only download of 2.6.3 available was the source code .tar.gz.  After download this and screwing around with it for awhile (couldn’t figure out exactly which options to use in configure and make…), I decided to chicken out and look for the most recent version that provided a .dmg install for Mac.  2.6.2 from April 2009 had a .dmg, so I went ahead an installed that.  After removing the default /usr/bin/python related links, I now had a new install of Python 2.6.2 in /usr/local/bin.  So far so good.

The next step would be to get mod_wsgi setup in my current Apache install (version 2.2).  I followed the directions on the mod_wsgi install documentation, and almost got through them.  I read through the MacOSX-specific install instructions, and didn’t really see anything that applied, so I figured I was okay.  I modified the httpd.conf file to load the mod_wsgi module, and this is where the fun started.  When I tried to restart Apache, I got the following error:

httpd: Syntax error on line 117 of /private/etc/apache2/httpd.conf:
Cannot load /usr/libexec/apache2/ into server:
dlopen(/usr/libexec/apache2/, 10):
Symbol not found: _PyExc_RuntimeError
  Referenced from: /usr/libexec/apache2/
  Expected in: dynamic lookup

I searched around for some more info, and after reading through a bunch of blog posts and forums, I learned that this was most likely happening because the Python shared library was only build in 32-bit mode, whereas, the default build of Apache on MacOSX 10.5 runs in 64-bit.  At least that’s what I made of it, not sure if that’s completely accurate…  The docs on the mod_wsgi site for MacOSX mention that you need to add extra -arch flags to the Makefile when building mod_wsgi for 64-bit, but that wasn’t the problem.  Those flags were correctly generated by the configure script, and my library was built with full 32 and 64-bit architecture support.  The problem appeared to be that when Apache tried to load the, the was trying to load the default Python library, which was only built for 32-bit.

I searched around some more, and found this excellent blog post: on this very subject.  The post describes the exact problem I was having, and provides the steps necessary to build Python in the full “fat” architecture (all 4 archs), as well as mod_wsgi.  I was about to try out the described steps, when I noticed a link to another blog:  This procedure seemed much simpler, so I decided to try that first.  It would involve over-riding the default launchd configuration for Apache, so that the process would be launched in 32-bit mode, rather than 64-bit when the Mac starts up.  I tried this out and eventually got it to work, but the problem with this is that if you do a “sudo apachectl restart”, it ignores your launchd configuration and starts apache up in the normal 64-bit mode.  I decided to give up on this and keep looking.

I then found this blog post:  This post presents a novel idea:  avoid all the trouble with 64-bit, and just dumb Apache down to the sane level of 32-bits!  I’m not sure why Apple decided to have Apache run in 64-bits when everything else basically runs in i386 (32-bit) mode.  I thought this might be a nice, simple approach, so I’m going to give it a whirl…

This post is already too long, so I’ll post an update if I come up with any new information!

Tags: , ,

The Web of the 90s (Web0.9beta)

Posted by Andy on May 09, 2008
Computers, Internet / No Comments

I just read an article: “RIP Web Trends of the 90s,” and it reminded me how much I miss the earlier days of the wide world of webs. (Not really…) I’m talking about the 90s web; the days of old when Prodigy and AOL ruled like kings, and Geocities and Tripod hosted pretty much every personal site, free of charge. These were the days of yore when PCs were a creamy beige in color, and still had that nice 5 ¼ inch floppy drive, which would allow you to store away up to 5 of your favorite animated gifs for future viewing.

Here are a few of the web trends from that great era (some of these are repeats from the article above, but they’re classics, so I thought they were worth reiterating):

  • Animated gifs (as mentioned before) – who could forget that explosion gif featured on the nearly every heavy metal fan page, or that fist gif that was continuously punching its way out of the page? I also like the “Under Construction” banner that everyone used, and the little construction guy, tirelessly working away to finish construction on your Metallica web-ring page (hosted on geocities of course).
  • Webrings – speaking of webrings, what ever happened to those? I guess now that we have these search engines, it’s no longer useful to insert your site into a ring of links.
  • “Best Viewed With” links to Netscape or Internet Explorer. I guess these were probably valid back then – pages probably looked quite a bit different in those old browsers. Interestingly enough, this “Best Viewed With” nonsense went out of style for awhile, but now smug Firefox users are trying to bring it back in an attempt to usurp the dominance of Internet Explorer.
  • MIDI music – before mp3s assumed their rightful place as king of all things downloadable, I remember scouring the web for MIDI interpretations of my favorite songs. These, along with your collection of animated gifs, could be conveniently stored on floppy disk for future listening pleasure.
  • Modem sounds – I have a friend whose cell phone ringer is a recording of the beeps and hissing of an old modem dialing up to the net. I think that’s pretty funny. Now that I think about it, having to dial-up to the internet seems way old, but it wasn’t really that long ago.
  • Hit Counters – on my very first webpage, I felt compelled to include one of those odometer-style hit counters at the bottom of the page (a must for any 90s website). I quickly discovered that I could grant myself instant web credibility by clicking the browser’s refresh button over-and-over in a rapid fashion.
  • <marquee> or <blink> text – The telltale sign of a true 90s website is blinking or scrolling text. Often appearing in the vicinity of a glittery panda gif, colorful rainbow dots, or a barb-wire horizontal divider, the blinking and/or scrolling text adds just the right amount of class to any Web1.0 site.

I guess that about does it, feel free to comment with your favorite Web1.0 (or Web0.9beta if you prefer) trend.


A house built on a foundation of sand

Posted by Andy on November 18, 2007
Internet / No Comments

This internet is a pretty amazing achievement. I’m more and more amazed every time I try to make a new webpage, or do some new type of web project. In case you didn’t know, the internet is built on top of some pretty questionable technology. HTML is okay, it was a good idea at the time it was created, but it has gone through so many iterations of change and has been dragged through so many different web trends that it has gotten pretty messy. CSS is definitely powerful when combined with HTML, but it’s next to impossible to work with.  Javascript is a pretty crappy language, but has somehow become the standard for scripting, which is sort of unfortunate, you can’t really get away from it. It’s actually pretty amazing that everyone has done so much with all this junk.  Every time I go to a site like, I have to marvel at how much stuff they can cram into one page using html, css, and javascript, along with all the equally awesome server-side technologies. I’m definitely not saying I could come up with anything better, but I just find it interesting that so many web developers have gone so far with this stuff, learning all the nuances and quirks, it is truly amazing.