(Last Updated On: November 10, 2018)

Welcome to our guide on how to Install Pip3 and Django on Ubuntu 18.04 / Ubuntu 16.04 LTS. Django is a free and open source high-level Python Web framework designed to encourage rapid Web development without the need to reinvent the wheel. Pip is a package management system used to install and manage software packages written in Python.

This guide will take you through the steps to install Pip3 & Django on Ubuntu 18.04 / Ubuntu 16.04 LTS systems. This works for both Desktop and server installations.

Step 1: Install Python3 and Pip3

Your Ubuntu system should come with Python 3, if it doesn’t have it, install by running the commands below on your terminal.

sudo apt -y install python3 python3-pip

Step 2: Install Django on Ubuntu 18.04 / Ubuntu 16.04 LTS

The easiest and quickest way to Install Django on Ubuntu 18.04 / Ubuntu 16.04 LTS is via pip3.

Check your Python version

$ python3 -V
Python 3.6.6

Check installed pip3 version:

$ pip3 -V
pip 9.0.1 from /usr/lib/python3/dist-packages (python 3.6)

Download and install Django on Ubuntu 18.04 / Ubuntu 16.04:

pip3 install --user Django

For global installation, use:

sudo pip3 install Django

The installation of Django will give you django-admin command to manage Projects,

$ which django-admin

If ~/.local/bin/ is not in your PATH, add it like below:

$ vim ~/.bashrc


export PATH=$PATH:~/.local/bin/

Source the bashrc file

$ source ~/.bashrc

Check django-admin version using:

$ django-admin --version

Step 3: Create a test Django Application

Create a Django test application by running

mkdir projects
cd projects
django-admin startproject test_app
cd test_app

test_app is the name of our Django Project.

Apply pending migrations

$ python3 manage.py migrate
Operations to perform:
  Apply all migrations: admin, auth, contenttypes, sessions
Running migrations:
  Applying contenttypes.0001_initial... OK
  Applying auth.0001_initial... OK
  Applying admin.0001_initial... OK
  Applying admin.0002_logentry_remove_auto_add... OK
  Applying admin.0003_logentry_add_action_flag_choices... OK
  Applying contenttypes.0002_remove_content_type_name... OK
  Applying auth.0002_alter_permission_name_max_length... OK
  Applying auth.0003_alter_user_email_max_length... OK
  Applying auth.0004_alter_user_username_opts... OK
  Applying auth.0005_alter_user_last_login_null... OK
  Applying auth.0006_require_contenttypes_0002... OK
  Applying auth.0007_alter_validators_add_error_messages... OK
  Applying auth.0008_alter_user_username_max_length... OK
  Applying auth.0009_alter_user_last_name_max_length... OK
  Applying sessions.0001_initial... OK

Step 4: Create an Admin Account

Create a Django project superuser account by running the following commands from your Django application directory.

$ python3 manage.py createsuperuser
Username (leave blank to use 'jmutai'): admin
Email address: [email protected]
Password (again): 
Superuser created successfully.

Input your admin username, email address, and password.

Step 5: Allow external access to the Django web application (Optional)

Note that by default Django doesn’t allow external access to the application, you need to explicitly define an ACL.

$ vim test_app/settings.py

Edit the lineALLOWED_HOSTS to whitelist your Computer IP or LAN subnet.


You can now  start Django application server:

$ python3 manage.py runserver
Performing system checks...

System check identified no issues (0 silenced).
November 10, 2018 - 12:08:27
Django version 2.1.3, using settings 'test_app.settings'
Starting development server at
Quit the server with CONTROL-C.

If you open the URL http://[server IP/hostname]:8080 you should see a successful message like below:

Django Administration page is available on :8080/admin

Login with created username and password:

The admin page allows you to add other users, add groups, change password e.t.c. It looks like below:

You now have Django Framework installed on your Ubuntu 18.04 / Ubuntu 16.04 LTS system.