Install Django on Ubuntu 18.04 & 16.04 LTS


Django is a Python-based free and open-source web framework, which follows the model-template-view architectural pattern. It is maintained by the Django Software Foundation, an independent organization established as a 501 non-profit. Django’s primary goal is to ease the creation of complex, database-driven websites. In this article we will show you the steps to Install Django on Ubuntu 18.04 & 16.04 LTS


  • Sudo access to your Ubuntu 18.04 (or) Ubuntu 16.04 server

Step 1 – Installing Python and Pip

If you have launched a new server. Then we recommend to update the server with below command

sudo apt-get update

By default, Python 3 is installed on your VPS, but if your system doesn’t have Python installed. Execute the below commands to install it

sudo apt-get install python3 

To install pip. Use below command

sudo apt-get install python3-pip

Step 2 : Installing Django

Django source code is available as Github repository. You can also use pip to install Django on Ubuntu systems

pip3 install Django

After Django is installed. You can verify the version

django-admin –version

Step 3 : Create A Django Application

The django-admin command provides you the option to create a new Django application via command line. Navigate to the directory you need to create a new application and use below command

django-admin startproject django_app

Go to the path and migrate the changes

cd django_app
python3 migrate

Step 4 : Creating a Super User for Django Application

We will now be creating a superuser account for the administration of the Django application. Run the following command from your Django application directory.

python3 createsuperuser

Step 5 : Run the Django Application

Your Django application is ready to use. By default, Django doesn’t allow external hosts to access the web interface. To allow external hosts, edit file and add IP under ALLOWED_HOSTS.

vi django_app/

Add the IP

ALLOWED_HOSTS = ['your_server_IP']

Finally, run the Django application server with below command

python3 runserver

Django application server is running now. Open your web browser and access the Django Application with your server IP on port 8000. This will show you the default Django web page. Before accessing the Django application on browser,You need to open the port on the server to access it externally


You have now installed Django application on your server. After accessing and login to browser you can add more users and groups for your application and proceed with your setup.

On this page