Setting up a Mac for Django Development

I usually use Linux for doing python and django development.   However last night my Linux PC choked up yet again due to bad video drivers and I was forced to do a hard reboot.

That was the final straw that made me switch over to using my Mac for most of my development work going forward.

I keep my current projects in Dropbox so that they are always up to date across all the computers I use day to day.  So there was nothing to do to get those files migrated over to the Mac.

My python and django development environment is pretty light weight. I use:

  • virtualenv
  • vim
  • textmate
  • terminal with zsh
  • mercurial

I don’t do django stuff in an IDE.  I find them a bit too heavy for coding.  Instead I opt for using either Vim or TextMate.  Very simple, text editing with little clutter or UI to get in the way.

I use the standard Mac Terminal app but I’ve changed the standard bash shell over to zsh using Oh My zsh. Which can be installed with this one line:

curl -L | sh

Virtualenv is a necessity.  It keeps all the projects I work on isolated so that I can set versions for all the libraries and come back to a project a year later and still have it work immediately.  Setting up virtualenv and virtualenvwrapper on the Mac was fairly easy:

$ sudo easy_install pip
$ sudo pip install virtualenv virtualenvwrapper
$ mkdir ~/.virtualenvs
$ echo "export WORKON_HOME=$HOME/.virtualenvs" >> ~/.zshrc
$ echo "source /usr/local/bin/" >> ~/.zshrc

Restart the terminal after that. Now ‘workon’ and ‘mkvirtualenv’ will be available for working on and creating virtualenv python environments.

Mercurial is what I use to version control all my projects. I just find it makes more sense than git and the command line is much simpler and cleaner.

That’s pretty much it.