Django is a Python Web framework that encourages rapid development of applications. The Django framework is designed for developers to take applications from initial to completion as quickly as possible. It provides higher security for the application and avoids developers for making common security mistakes.

This tutorial will help you to setup Django Python framework on Ubuntu 20.04 LTS system. It will also help you to create a sample Django application. Let’s go through the tutorial:

Step 1 – Installing Python

Most of the latest operating systems come with default Python 3 installed. But if your system doesn’t have Python installed, Execute the below commands to install it. Also, install pip on your system.

sudo apt update -y 
sudo apt install python3 python3-pip -y 

The installed Python version is:

python3 -V 

Python 3.8.2

And pip version is:

pip3 -V 

pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8)

Step 2 – Installing Django Python Module

You can install Django either from source code available in Github repository or install it using PIP . In this tutorial, I use pip for the Django installation on Ubuntu 20.04 system. Run the below command from Linux terminal:

pip3 install Django 

You will get a django-admin command for creating new projects. Check the current installed version:

django-admin --version 

3.1

Step 3 – Create Django Sample Application

First, navigate to the directory you need to create a new application. Then use django-admin startproject command followed by the application name to create a new Django application. Open a terminal on your system and type:

mkdir -p /var/www && cd /var/www 
django-admin startproject django_app 

After that migrate the pending changes.

cd django_app 
python3 manage.py migrate 

Django Migrate Data

#python framework #django #ubuntu

How to Install Django on Ubuntu 20.04
3.35 GEEK