Django + Postgres + Virtualenv + MacOSX - Perfect Local Development Environment

Getting a local environment set up for Django development is remarkably easy these days but I thought I would write out the steps as I completed them on my new Macbook Pro. If you don’t need a full fledged database engine you can just skip step 2 and use SQLite which comes pre-installed.

  1. Mac’s come with Python already installed. To check what version you have open Terminal.app and type “python”. If you have a version older than 2.5 I would update to a later version.
  2. I prefer to work with a Postgres installation locally so I can easily import and export real data to and from a site. To install Postgres follow our installing Postgres on a Mac tutorial. Keep in mind that most servers will be running several versions back, so in this case I used the 8.3 version since its the most likely to match the version on the server and behave the same.
  3. Install virtualenv to easily duplicate and switch between server environments locally. Open terminal and run this: sudo easy_install virtualenv
  4. I found this guide to working with virtualenv to provide all the key commands for setting up and working on virtualenv.
  5. Install Django by following the instructions at the bottom of this page.
  6. Install other modules as needed for the project build.

Comments