Quantcast
Channel: JS Tricks » Python
Viewing all articles
Browse latest Browse all 25

How to Install Django on your favourite Operating System

$
0
0

Django is a python based framework. And this is a high-level Python Web framework which will help you in rapid development and clean, pragmatic design. Django comes up with a lightweight web server for development and testing. Django also has a template engine which is extend able. Django has many other powerful features which will relieve you from writing vast amount of code. To learn more about it you should first install Django.

In this tutorial we will learn how to install Django on several top Operating Systems.

Installing Django Dependencies

If you want to install Django then first you need to have python installed on your system. Check if your system has already installed in you system by using this command:

python -V

This command will return the Python version number. For my case the command returned Python 2.7.4 . If you don’t have python installed then install it.

If you want some optional packages which are sometime required by Django then run the following command to install the these packages:

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

If you want to install Django with pip command then first you need to have pip installed. To install or upgrade pip, first download get-pip.py. Then run the following command (this may require administrator access):

python get-pip.py

If you are using Ubuntu then you can use the following command to install pip:

apt-get install python-pip

Installing Django

Install Django on your favourite Operating System

Install Django on your favourite Operating System

Install Django with pip

If you are using Windows then this is the best method for installing Django, although pip can install Django on any Operating System. To install the latest Django version with pip use the following comand:

pip install Django

If you want to install a specific version then use this command:

pip install "Django<1.6"

In this case the Django version is specified 1.6, you should select your required Django version while using this command.

Install Django without Aptitude

If you don’t want to use aptitude to install Django, then this is the most common way for installing Django. In this method, we will download the official stable release and install it. In this case the version is 1.6. You should pick your version.

wget https://www.djangoproject.com/download/1.6/tarball/
tar xzvf index.html
cd Django-1.6
sudo python setup.py install

You can use this command to check that Django is installed and working

django-admin.py

You should get below response, and it will be followed by a long set of options.

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

Installing Django from the Git Repository

Another secure and smart way to install Django is by installing it by Git. If you want the latest release of Django which supports all major features, then download it through git.

Before you start, you need to download git. In Ubuntu you can use this command :

apt-get install git-core

For CentOS the command would look like this:

sudo yum install git

Once it downloads, then you can install Django:

git clone https://github.com/django/django.git

Install Django with Aptitude

Although this is not the recommended way of installing Django because it always installs an older version. But if you still want to follow this method or want to use this method as a backup process then you can use this command :

sudo aptitude install python-django

Once Django has been installed, you can check that Django is installed and working.

django-admin

The prompt will show the line below, followed by a long set of options.

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

 

The post How to Install Django on your favourite Operating System appeared first on JS Tricks.


Viewing all articles
Browse latest Browse all 25

Trending Articles