Sunday, September 16, 2012

Installing django on ubuntu and updating to version 1.4

I know there is a way to install django on any OS is to just go to django site and download it from there but many programmers and/or linux users always want to have a command to install anything. If you have experience of installing ruby on linux then believe me installing django is much more piece of cake from terminal. To install django the simplest way in my opinion is to just type:

sudo apt-get install python-django

and Django is installed, however please note that in this way you will may be not get latest version. At the time of writing this post, the above command installs django version 1.3 while django version 1.4 is also present.  So if you want to install django version 1.4 then just copy paste the following commands one by one in your terminal.

wget "http://www.djangoproject.com/download/1.4/tarball/" -O Django-1.4.tar.gz 
tar xzvf Django-1.4.tar.gz 
cd Django-1.4 
sudo python setup.py install

However if you have django older version of django already installed then you need to first remove it via following command before installing newer version.

         sudo apt-get remove --purge python-django

To make sure that django is installed and to see what version you have open python by just typing python in terminal. And then type:
       
>>import django
          >> django.get_version()

And if there is django installed then there will not be any error and last line will show version number of django. I hope it is clearer, if not then please tell by commenting. And if there is some better way then please tell. If there is something more you want to know then please tell. Don't forget to subscribe and comment if you like the post.