How to install django


In this article, you will learn how to install django under Linux / UNIX environments.

 

Note: We will be using Debian based operating system Ubuntu 12.04 LTS, It works under Ubuntu 10.04 LTS, Ubuntu 13, Debian 6 and Debian 7.

With these instructions, we assume that you have your machine up and running, and your hostname and network configured. If not, please refer to one of our previous articles.

 

What is Django?

Django is a web application framework written in Python and its very famous MVC (Model View Controller) architecture model.

 

Let’s first install django on your machine. There are many optional packages that can be used with django. We recommend installing the optional packages to avoid any compatibility issues.

 

To install optional packages for django, first update your repositories and the software packages that are installed currently on the machine:

sudo apt-get update

sudo apt-get upgrade

sudo aptitude install python-imaging python-pythonmagick python-markdown python-textile python-docutils

 

If you want information about each package and what it does or whether this package is right for you, you can use the below command:

aptitude show python-pythonmagick

 

Now, it’s time to install django on our machine / server.

 

sudo aptitude install python-django

 

Once the installation is complete, check whether django is installed or not. You can verify by using the following command:

django-admin

 

The above command will display with a list of set options and arguments this command has; this means that django has installed without any problems.

Output of above command will be similar to this:

Usage: django-admin subcommand [options] [args]

 

If you do not want to install the latest version of django without using the repositories― you may download the tarball source code, compile and install. This may apply to operating systems like CentOS , RHEL (Redhat Enterprise Linux), Debian and Ubuntu.

 

wget https://www.djangoproject.com/download/1.5.1/tarball/

tar xvzf index.html

cd Django-1.5.1

sudo python setup.py install

 

Verify installation is complete

Follow the command below to check if the installation of django is complete:

django-admin

 

The above command will display a list of set options and arguments; this means that django has installed without any problems.

Output of the above command will be similar to something like this:

Usage: django-admin subcommand [options] [args]

 

We have now installed the latest stable release of django on our operating system. It’s now ready to be used by using a web server; there are many methods to do so by using mod_wsgi.

You can also refer to our previous article titled, ‘How to setup python with mod_wsgi and apache’ for more information. 

Posted in
Last update:
2015-12-03 20:39
Average rating:0 (0 Votes)