Mavericks + Django

As I’m changed work a few times the past few years I’ve had to get a Django install up and going on each new machine I’ve used. Here’s a quick run through to get a local development environment for Django up and running in Mavericks in no time.

First off, we need install pip so we can get the other packages we need.

sudo easy_install pip

We’ll want to use virtualenv so we can have multiple Django versions and python environments.

sudo pip install virtualenv
sudo pip install virtualenvwrapper

Then you need to add the next lines to the file at ~/.profile or ~/.bash_profile. If they aren’t there you can create one.

 export WORKON_HOME=$HOME/.virtualenvs
 export PROJECT_HOME=$HOME/Devel
 source /usr/local/bin/

Next, since I prefer to the Postgres database I like to use Homebrew.

ruby -e "$(curl -fsSL"

Now we can easily install Postgres

brew install postgresql

Then to start postgres automatically

ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents

Follow the instructions at the end of the install to launch Postgres now.

You’ll need to use pip to install psycopg2 and pillow etc in each virtualenv.

Then, just mkvirtualenv myenvironmentname and Bob’s your uncle.

One last thing. I like to use pgadmin to manage my postgres databases. Yes, you can do that all via command line, but who wants to. The only tricky part about the setup is that when making the initial connection to the server you have to use your username on your Mac in the User field.

comments powered by Disqus