How to install and run Django on Ubuntu

Django is a very popular framework of Python to develop a web application. It works like MVC based framework. SQLite database is used in Django by default. But it supports other popular databases also. How you can install Django 3+ on Ubuntu 20.10 and run the Django development server is shown in this tutorial.

Install Django:

Steps:

01.Update the current system.

$ sudo apt-get update

02.Python 3+ is installed on Ubuntu 20.10 by default. Check the installed version of Python.

$ Python -V

03.Install Django for Python3

$ sudo apt-get install python3-django

04.Check the installed version of Django.

$ django-admin –version

Run the Django Server:

Steps:

01.Create a new Django Project named myDjangoProject.

$ django-admin startproject myDjangoProject

02.Go to the project folder.

$ cd myDjangoProject

03.Apply default migration.

$ python3 manage.py migrate

04.Create database user to access the Django Administrative Panel.

$ python3 manage.py createsuperuser

05.Run the server.

$ python3 manage.py runserver

Run the following URL to check Django is working or not.

http://localhost:8000

Run the following URL to open the Django Administrative Dashboard.

http://localhost:8000/admin