Open terminal and write python to see if you have it installed. If not, then install latest version from here: Python Download | python.org In OS X you should have an older version available by default.

Short Version

1
2
3
4
5
6
pip install django
mkdir ~/MyProjects
cd ~/MyProjects
django-admin startproject myproject01
cd myproject01
./manage.py runserver

Long Version

Install Django package:

1
pip install django

pip is a package manager for Python. Check Python Package Index (PyPI)

Note: this will install Django in a general location like /usr/local/lib/python2.7/site-packages. In the next tutorial we will use Python 3 and Virtual Environment.

Create a folder for your projects:

1
2
mkdir ~/MyProjects
cd ~/MyProjects

Create a project folder structure:

1
django-admin startproject myproject01

django-admin is a command line tool for administrative tasks. Each generated Django project has a manage.py file that replicates the django-admin functionality. Read more django-admin | djangoproject.com

Now you should have this kind of folder structure:

1
2
3
4
5
6
7
8
MyProjects
├── myproject01
│   ├── manage.py
│   └── myproject01
│       ├── __init__.py
│       ├── settings.py
│       ├── urls.py
│       └── wsgi.py

Run the development server:

1
2
cd myproject01
./manage.py runserver

Use this server just for development. It’s not suitable for production.

Visit http://127.0.0.1:8000/ with your browser and you should see: It worked! Congratulations on your first Django-powered page..


In the next tutorial we will use Virtual Environment to contain packages: Django - Beginner #2 - Virtual Environments