Skip to content

Instantly share code, notes, and snippets.

@Bpless
Last active January 2, 2016 18:29
Show Gist options
  • Save Bpless/8344382 to your computer and use it in GitHub Desktop.
Save Bpless/8344382 to your computer and use it in GitHub Desktop.
Setting up your Django Environment

Setting up your dev environment

The instructions that I've laid out below should handle most of the process, but if you get confused (or want to validate that something is correct), check out this awesome tutorial for setting up a Django environment -- https://docs.djangoproject.com/en/dev/intro/tutorial01/

Whenever you see a white background with red text coloring in the sections below, that is a bash command to be run in your terminal.

Start by installing the following:

  • Command Line Tools for Xcode or Xcode - Available at the Apple Dev Center. Command Line Tools for Xcode is a smaller package but is only available for OS X Lion or higher, if you don't have it, download and install Xcode.
  • Homebrew - Download and install at http://mxcl.github.com/homebrew. Please follow the instructions carefully and place your Brew directory (/usr/local/bin by default) at the beginning of your $PATH.
  • Sublime Text 2 - Sublime Text 2 is a program to help edit text files. Download the latest version from http://www.sublimetext.com/.

Brew packages to install

Homebrew is a package installer for Mac that makes it easy to install things like MySQL and Git. It's not necessary (you can install these packages manually) but you should try to use it. When you install Homebrew packages, make sure to read all terminal output to see if there are additional instructions. Note that some of the packages below may install others from the list automatically, so don't worry if something already exists on your computer when you try to install it.

  • MySQL -- brew install mysql (Make sure to follow the brew caveats and don't set a password, i.e. leave the password field blank)
  • Git - brew install git

Setting up virtualenv with pip

The main point here is that pip is a tool for installing Python packages (libraries) -- including Django

https://github.com/natea/djangostarterkit/wiki/Mac-Linux-Setup

http://glowfilter.com/blog/isolated-django-development-environment-virtualenv-pip-os-x/

Setting up Git

Git is a version control system (basically allows us to see how our code has changed over time and restore older versions or merge our work with others). You will want to set up a github.com account if you do not have one already.

https://help.github.com/articles/set-up-git

Setting up your MySQL Database

Make sure you have a clean database called [name of your project]

mysql -u root -e"drop database if exists [name of your project]; create database [name of your project];"

Everything is installed, time to create your project

Additional helpful resources

Some optional things that are helpful but not necessary:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment