I installed Ubuntu 12.10. Is django installed by default on my Ubuntu? If not, how can I install it?


Django is not installed by default. Django is a webframework written in the language python. Python is installed by default. To install django, there are essentially two ways to proceed.

1. Use the Ubuntu package manager

Ubuntu has a version of django in its package system. If you just want to play around with django and learn what it is (and maybe do a simple project or two) you can run

sudo apt-get install python-django

2. Use pip and PyPi, the Python package manager

In the django community the standard procedure for most developers would be to use pip. Pip is "a tool for installing and managing Python packages." You can install it as follows:

sudo apt-get install python-pip python-dev build-essential 
sudo pip install --upgrade pip 

Once pip is installed you can type pip freeze in your terminal to see the list of packages installed. You can install django using pip install django.

There is one thing to note, though. This will install django systemwide (for alternative instructions, see How to install django?). Normally you would want to install django in a virtual environment. There is a bit of a learning curve to these tools, but they help you to get a good development environment.

sudo pip install --upgrade virtualenv 

http://www.saltycrane.com/blog/2010/02/how-install-pip-ubuntu/ http://warpedtimes.wordpress.com/2012/09/23/a-tutorial-on-virtualenv-to-isolate-python-installations/


If you are starting with Django, installing it using the package manager is probably simpler.

While there are some good reasons to use virtualenvs and pip, they are more complicated and you need to manage the upgrade cycle yourself (i.e. you need to update core components when security updates are releases for example).

So, until you hit some of the problems that virtualenvs resolve you can just use the Software Center or type in the terminal:

sudo apt-get install python-django
  • This installs django 1.4.1-2ubuntu0.3, not the latest django release (1.5). Pip installing python packages is way easier and the pip version of django is 1.5. All that said, the command you provide is indeed an easy way to test django quickly. – don.joey Mar 25 '13 at 9:08
  • 1
    The django version that will be installed depends on the Ubuntu version that you are using, but a secure version is guaranteed. Pip has it uses, usually in combination with virtualenv when you need to use different library versions, but it's a crazy idea for a novice, the most likely result is a outdated django installation with known security bugs. – Javier Rivera Mar 25 '13 at 10:29
  • @Private "Pip installing python packages is way easier" Are you kidding? Ubuntu users are probably familiar with Ubuntu packages, not with PyPi packages. Maintaining virtualenvs or Pip-installed packages in site-packages is not for novices starting with Django. – gertvdijk May 13 '13 at 11:11
  • @gertvdijk I am not kidding. :) Easy is subjective. So let's not get in a rant about this. Pip installing anything django-related that goes further than basic packages is easier (in the sense of 'more durable on the longterm and easier to test other packages which require specific versions). Using pip is also likely to be helpful when deploying. I will complete my answer by adding that you can also simply use apt-get if you just want to play around with django. By the way: are you seriously using the ubuntu version of django in your projects? – don.joey May 13 '13 at 12:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.