Django on Snow Leopard

Having just been given an new MacBook Pro as an early birthday present, it didn’t take me long to try and install Django on it. Rather than use the MacPorts solution I decided to use the native python 2.6 and build the rest, apart from MySQL (use the Mac OS X 10.5 (x86_64) package from here)

Before proceeding make sure that you have installed XCode (It’s on the Snow Leopard install disc) as we need it to install libjpeg and PIL (all of my Django projects use this!)

Download libjpeg then:

tar -xzf jpegsrc-1.v7.tar
cd jpegsrc-1.v7
ln -s `which glibtool` ./libtool
set env MACOSX_DEPLOYMENT_TARGET 10.6
./configure --enable-shared && make && sudo make install

Now we can download the source and build PIL

tar -xzf Imaging-1.1.6.tar.gz
cd Imaging-1.1.6
sudo python setup.py install

Last thing to do before we install Django is to install the MySqlDb connector – you will need to do add the following to your .bash_profile

PATH="${PATH}:/usr/local/mysql/bin"

Then:

sudo easy_install mysql-python

Now we can easy_install Django:

sudo easy_install django

and we are all set to go :)

Thanks to these guys for the help in figuring this out:
http://dryan.com/
http://www.brambraakman.com/blog/
http://colbypalmer.com/
http://www.agapow.net/

Tags: , , , , ,

5 Responses to “Django on Snow Leopard”

  1. Tim Says:
    October 6th, 2009 at 20:57

    This would have been great this morning!

  2. Nick Says:
    October 21st, 2009 at 00:08

    Wow – thanks for posting this. Works great!

  3. Andrey Says:
    April 26th, 2010 at 11:01

    hey
    Thank for your article
    It’s work on my computer
    again
    Great Thanks

  4. rych Says:
    February 24th, 2011 at 05:37

    Awesome, thanks!
    Just built libjpeg ( jpeg-8c ) and Imaging-1.1.7 seven or eight times according to various tips. Yours worked.

    I had been getting this error:
    ImportError: The _imaging C module is not installed

    Thanks for posting. big help.

  5. Python:Django/PIL Error – Caught an exception while rendering: The _imagingft C module is not installed – IT Sprite Says:
    October 23rd, 2015 at 08:28

    […] First you need to download Freetype2 http://freetype.sourceforge.net/index2.html and compile it with these instructions http://www.libgd.org/DOC_INSTALL_OSX#Building_freetype2 then you go and compile libjpeg and PIL http://fightingrabbits.com/archives/266 […]

Leave a Reply