Installing Django

What is Django? Django is a powerful and fully-customizable web framework written in Python. Some websites like Instagram used it. Django  has a rather unique concept: MTV (Model-Template-View), unlike most web frameworks. As you can see, there is no “controller” in Django. Django provides “View” to help developers implementing the controller’s jobs. “View” is the place for retrieving data from “Model” to be displayed on “Template”. What is “Template”, anyway? Templates are simply the front-end component. They used a templating language, a language that differs from Python itself. It is very simple, with basic programming logic like operator or loop. For example, you can make HTML files as templates, with template language on them.

So now, how to install Django? Quite simple. The steps are just simply:

  1. Install Python
  2. Install pip
  3. Install Django

Installing Python

Installing Python is very simple. But which version? I recommend version 2.7 since it worked perfectly on running Django.

On Windows, you can get the installer from here.

On ubuntu, you can run these commands:

sudo apt-get update
sudo apt-get install python2.7

Once Python have been installed, you can install “pip” now.

Installing pip

Pip is a tool for installing and managing Python packages, including Django. Installing pip on ubuntu is very simple, just run this command:

sudo apt-get install python-pip

For windows, first you must add these paths into your environment variables “PATH”:

C:\Python27\
C:\Python27\Scripts\

And then, run python-distribute script to install easy_install

python distribute_setup.py

Install pip with easy_install

easy_install pip

Installing Django

The command for installing Django with pip is very simple:

pip install django

To install Django with specific version, run this command:

pip install django==1.4.2

You can replace 1.4.2 with any Django version, such as 1.3.1 or 1.5.0.

Remember that you must use sudo for installing python packages with pip on UNIX-based operating systems.

Verify Django Installation

To make sure if Django is properly installed, you can simply import Django and then view the version, like this:

$ python
>>> import django
>>> django.VERSION
(1, 4, 2, 'final', 0)

Congratulations! Now you can start making your Django projects!

Advertisements

3 thoughts on “Installing Django

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s