Installing Django on OSX
May 31, 2006 15:52 (Sydney Australia)
Whilst Django is checking out of SVN I’ll give you a quick checklist to get it up and running on OSX.
- Install MySQL
- Install darwinports
$ sudo port install subversion$ sudo port install python24- Add
/opt/local/bin:/opt/local/sbin:/usr/local/mysql/binto your path (before $PATH so as to use Python 2.4) - Download and extract mysql-python bindings
- Change dir into the extracted mysql-python
$ python setup.py build$ sudo python setup.py install$ mkdir ~/django$ svn co http://code.djangoproject.com/svn/django/trunk/ ~/django/django_src- Add
$HOME/django/django_src/django/binto your path - Add
export PYTHONPATH=$PYTHONPATH:$HOME/django/django_src:$HOME/django/django_projectsto your .profile
And there you have it:
$ django-admin.py
usage: django-admin.py action [options]
actions:
adminindex [appname ...]
Prints the admin-index template snippet for the given app name(s).
...
Instead of placing it in ~/django you could have put it somewhere nicer, like /usr/local/django, but I thought I’d keep it consistent with Jeff Croft’s article on setting up DJango on dreamhost.

Comments
Allan
Excellent, concise instructions, thought i would add a wee bit of clarity that might help:
Step 5: If using default bash shell the actual code should be:echo 'PATH=/opt/local/bin:/opt/local/sbin:/usr/local/mysql/bin:$PATH' >> ~/.bash_profilethen:source .bash_profileStep 12:echo 'PATH=$PATH:$HOME/django/django_src/django/bin' >> ~/.bash_profilethen, again:source .bash_profileStep 13:echo 'export PYTHONPATH=$PYTHONPATH:$HOME/django/django_src:$HOME/django/django_projects' >> ~/.profilefinally:source .profileCheers TT!
Tim Lucas
Thanks Allan! Glad you found it useful.
Apologies for the line breaks…
Sean Schertell
Can you please explain the difference between .profile and .bash_profile ?
Why is some stuff going in one and other stuff in the other?
Tim Lucas
Most (all?) shells have their own preferred config file, and then fall back on
.profile. If it’s BASH specific it should probably go into.bash_profile. I’m usually too lazy to pay much attention…Why Allan’s last step suggests using
.profilebeats me.Nick Muller
That was sweet Tim!
cheers, very much
Allan
That my newbie mistake, you’re quite right – the final step should have been consistant with the rest and read .bash_profile’ not ’.profile’. But as Tim’s instructions indicate you can use .profile all the way through, I just put up what worked for me!
baldo
how to make this step in osx?
Add $HOME/django/django_src/django/bin to your path
I don’t know where is the “path” thing..
Tim Lucas
baldo: See the first comment by Allan above.
Kelsey Ruger
Just wondering. Since you are already installing Darwinports, why can’t you use that to install Django? Does it not work?
To comment on this article you must have javascript enabled.