So, you’ve just installed brand-new Ubuntu 12.04 and want to install one of the best python web frameworks, Django. But how? Follow these steps and you can have Django running in a few moments.
Check for python version
Open up the Terminal application (in Dash or simply Alt+F1, Enter and type ‘Terminal’) and type in python –version
If the version of Python is from 2.6 to 2.7, it should be fine. Django doesn’t work with python 3.0 so you will need to downgrade or install separate python language of these versions.
There are more ways of installing Django web framework.
1) Install it with the help of apt-get under Ubuntu or other linux distributions based on Debian.
Fire up the Terminal and type in sudo apt-get install python-django
After a while, Django should be downloaded and installed in the correct directory. The downside of this way of installation is that it downloads the version of Django suitable for your version of python and Ubuntu, for example Django 1.3.1. However, sometimes you may want to have the latest version of the framework so you need to use the second way of getting it.
2) Install it as an official release manually
Head to the official Django download page and grab the latest release. Untar the downloaded file (you can simply double click on the downloaded file and untar it with Archive Manager). Back to the Terminal window. There, navigate into the directory where Django was extracted (e.g. cd Django-X.Y , where X.Y is the version number of the latest release). After that, type in sudo python setup.py install
at the shell prompt.
Violla, Django should be correctly installed in your python installation’s site-packages directory.
Testing the installation
To test if it was installed as it should have been, in Terminal type django-admin. If it shows some help and commands, everything should be O.K. Alternatively, you can also type python and then try to import django, e.g. import django in python console.