Tutorial

Installing Django on Ubuntu 12.04

Published on July 18, 2012
Installing Django on Ubuntu 12.04

Status: Deprecated

This article covers a version of Ubuntu that is no longer supported. If you are currently operate a server running Ubuntu 12.04, we highly recommend upgrading or migrating to a supported version of Ubuntu:

Reason: Ubuntu 12.04 reached end of life (EOL) on April 28, 2017 and no longer receives security patches or updates. This guide is no longer maintained.

See Instead:
This guide might still be useful as a reference, but may not work on other Ubuntu releases. If available, we strongly recommend using a guide written for the version of Ubuntu you are using. You can use the search functionality at the top of the page to find a more recent version.

Prerequisites

As a prerequisite, we are assuming that you have gone through the article on how to set up your droplet and now you are ready for a Django project. If not, you can find the article here

First, we will log into droplet.

ssh –p 25000 demo@12.34.56.789

Remember to replace ‘2500’ with the number of port you used in the previous article.

Replace ‘demo’ with your username and ‘12.34.56.789’ with your droplet IP.

Django uses sqlite by default, but, you can use other databases like MySQL, PostgreSQL etc as well. In this article, we will not be using any database.

Optional installations

There are a number of optional packages that can be used with Django. Run the following command to install the optional packages.

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

If you want more information about the package then use ‘show’ subcommand with the respective package name.

 aptitude show python-imaging

These packages are optional and frequently used. So it’s up to you if you want to use them with Django or not.

Installing Django

Now, we will download the Django unto our servers.

Installing Django with Aptitude:

To date, this is not the recommended way of installing Django as it comes with an older version. However, if you still want to follow this method, you can use this command

 sudo aptitude install python-django

Once it has download, 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]

Move on to the Next Steps section at the end of the article.

Installing Django without Aptitude:

If you don’t want to use aptitude, then this is your best bet for installing Django. In this method, we will download the official stable release and install it manually.

 wget https://www.djangoproject.com/download/1.4/tarball/
tar xzvf index.html
cd Django-1.4
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

If you are looking for the latest release of Django that supports all major features, then download the program through git.

Before you start, you need to download git:

apt-get install git-core

Once it downloads, you can install Django:

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

Then more on the next steps.

Next Steps

By now, we are done with the installation of latest, stable release of Django. Now, we are ready to install a web server that will actually serve the Django app. There are a number of methods for installing web server but we will be focusing on mod_wsgi.

By Etel Sverdlov

Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.

Learn more about us


About the authors

Still looking for an answer?

Ask a questionSearch for more help

Was this helpful?
 
5 Comments


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

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

what this? the options and args is mean?

I’m agree with pacofvf to use

pip install Django

It’s the recommended way to install Django (their words - https://docs.djangoproject.com/en/1.6/topics/install/#installing-an-official-release-with-pip)

Kamal Nasser
DigitalOcean Employee
DigitalOcean Employee badge
January 14, 2014

helpxuezia@gmail.com: It means that django-admin is installed properly. You can now use it, try <code>django-admin help</code>.

this is not the recommended way to install Django or any python package for that matter, please use pip to avoid any version issues:

pip install Django

I appreciate your posting this! I use linode, but free tutorials like this are a great way to drive traffic. I’ll consider you guys in the future!

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Join the Tech Talk
Success! Thank you! Please check your email for further details.

Please complete your information!

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel