How to Install Django on Ubuntu 16.04

How to Install Django on Ubuntu 16.04

We’ll show you How to Install Django on Ubuntu 16.04. Django is a free and open source, Python-based web application framework. It is a set of useful components that help developers to easily and quickly create their applications. Django is built and maintained by experienced developers and used by some of the world’s biggest companies and governments. Also, some of the most popular websites such as Instagram, Mozilla, Pinterest, The Washington Times and Disqus are using Django. Installing Django on Ubuntu 16.04, is an easy task if you follow the steps bellow carefully.

Django has tons of great features such as the following

  • Extremely Fast: Designed for quickly creating applications from concept to completion.
  • Fully Loaded – Django includes a lot of extras that can help you handle common Web development tasks, such as user authentication, content administration, site maps, RSS feeds, and many more tasks — right out of the box.
  • Very Secure – Django takes security seriously and helps developers avoid many common security mistakes, such as SQL injection, cross-site scripting, cross-site request forgery and clickjacking. Its user authentication system provides a secure way to manage user accounts and passwords.
  • Easily Scalable – Some of the largest and busiest sites are using Django’s ability to quickly and flexibly scale to meet the heaviest traffic demands.
  • Incredibly Versatile – Companies, organizations, and governments have used Django to build all sorts of things — from content management systems to social networks to scientific computing platforms.

In this tutorial, we will show you how to install Django on an Ubuntu 16.04 VPS through pip.

1. Login via SSH

First of all login to your Ubuntu VPS as user root

ssh root@IP

It is a good practice to always update all installed packed on the server to the latest version. So once you are logged in, make sure that all packages are updated

apt-get update && apt-get upgrade

2. Install pip – Python package manager

The best way to install Django globally is by using the Python package manager (pip). This way you will always install the latest available version of Django on your server.

Install pip on your server by executing the following command

apt-get install python-pip

Or you can use Python3, as recommended by Django.

apt-get install python3-pip

You can find more detailed information about the pip installation in one of our previous blog posts.

3. Verify pip Installation

Check if pip is successfully installed

# pip -V
pip 8.1.1 from /usr/lib/python2.7/dist-packages (python 2.7)

or for Python 3 run

# pip3 -V
pip 8.1.1 from /usr/lib/python3/dist-packages (python 3.5)

4. Install Django

Now, you can install Django with one single command

pip install django

or if you are using Python 3

pip3 install django

5. Verify Django Installation

Check if Django is successfully installed on your server

django-admin --version
1.10.5

6. Update Django to the latest version

If you receive the following warning that you are using an old pip version

You are using pip version 8.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

You can go ahead and update it

pip install --upgrade pip

Of course, you don’t have to Install Django on an Ubuntu 16.04 if you use one of our Django VPS Hosting services, in which case you can simply ask our expert Linux admins to install Django on your Ubuntu VPS for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post on how to install Django on an Ubuntu 16.04,  please share it with your friends on the social networks using the buttons below or simply leave a reply in the comments sections. Thanks.

Leave a Comment