Section 1: Install Django on your local machine and run a simple page

If you have already installed Django, please jump to the next section.

If you are not sure if you have Django on your computer, please open terminal and enter:

python -c "import django; print(django.get_version())"

If you already have Django installed, it should show something like this:

Screen Shot 2014-11-12 at 5.56.59 PM

If you don’t have Django, please follow the rest of these steps.

Step 1: Verify that you have Python on your computer

Django requires Python to work.  Django can work with different versions of Python.

Make sure that your Python version is one of 2.7 or 3.2, 3.3, 3.4, 3.5 versions. Depending on the version of Django, you’ll need to make sure that you have a verified working Python version. As of May 20, 2015, version 1.8.2 is the stable release of Django.

Since Django comes along with a light SQLite database, you don’t need to worry about the database at this point.

Open your terminal and type:

python --version

If you already installed Python, something line this should show up:

Screen Shot 2014-11-12 at 6.00.01 PM

 

If your computer doesn’t have Python, you should download it from:

https://www.python.org/downloads/

You should either download the 2.7 version or 3.4 version. Since I am using 3.4 in this tutorial, 3.4 is recommended.

 

Step 2: Install pip

After you have made sure that you have Python, it is time to install pip.

pip is a tool that enable us to easily install Django.

If you are not sure if you have pip on you computer, you can open your terminal and enter:

pip --version

Screen Shot 2014-11-12 at 6.02.47 PM

If you don’t have pip on your computer, you have to get the get-pip.py installation file. Download the following:

https://bootstrap.pypa.io/get-pip.py

curl -O https://bootstrap.pypa.io/get-pip.py

Afterwards, change directory to the location get-pip.py, go to your terminal, and enter:

python get-pip.py

 

Step 3: Using pip to install Django

After you make sure you have pip installed on your computer, go to the terminal and enter:

sudo pip install Django

You will need to enter the password of your computer. You can also specify a specific version of Django to install. Since the stable release at the time of writing is 1.8.2, I’ll show the command to install that version:

sudo pip install Django==1.8.2

 

Section 2 : Start a project

Step 1: Create a project

Open your terminal, cd to your Desktop or the place where you want to put your project and enter the following command:

django-admin.py startproject blog

Screen Shot 2014-11-12 at 6.13.19 PM

You will see a directory called blog appear on the Desktop. It contains all the framework file to help you generate your website.

Screen Shot 2014-11-12 at 7.07.10 PM

 

Step 2:

In your terminal, cd to into the blog folder and enter:

python manage.py runserver

You will probably see:

Screen Shot 2014-11-12 at 7.10.05 PM

Now, open a web browser. In the address file, enter the address that is showing in your terminal.

On the terminal and yours, by default, it will say http: //127.0.0.1: 8000

127.0.0.1 means localhost on every computer.

So I enter: http://localhost:8000 or http: //127.0.0.1: 8000 inside the web address of my browser, and it takes me to the default view of a Django site! You did it!