This tutorial will help you to install the Django web framework in Ubuntu 20.04 Linux 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. The installed Python version is: And pip version is:

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: You will get a django-admin command for creating new projects. Check the current installed version:

Step 3 – Create Django 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: After that migrate the pending changes.

Step 4 – Create Django Super Admin Account

Also, create a superuser account for the administration of the Django application. Run the following command from your Django application directory.

Step 5 – Running Django Application

The Django application is ready to serve. By default, Django doesn’t allow external hosts to access the web interface. To allow external hosts, edit settings.py file and add IP under ALLOWED_HOSTS. Add IP: Here 192.168.1.239 is the IP address of the system where Django is installed. Finally, run the Django application server with below command. Here 0.0.0.0:8000 defined that Django will listen on all interfaces on port 8000. You can change this port with any of your choices.

Django application server is running now. Open your favorite web browser and access to Django system ip on port 8000. This will show you the default Django web page.

You can also access Django administrator page on /admin subdirectory url. Use your superuser login credentials created in the previous step to get access.

You will get the Django admin dashboard like below. You can add more users and groups for your application on dashboard.

Conclusion

You have successfully created Django application on your system. Let’s start building your Django application.

How to Install Django Framework in Ubuntu 20 04   TecAdmin - 63How to Install Django Framework in Ubuntu 20 04   TecAdmin - 17How to Install Django Framework in Ubuntu 20 04   TecAdmin - 77How to Install Django Framework in Ubuntu 20 04   TecAdmin - 9How to Install Django Framework in Ubuntu 20 04   TecAdmin - 44How to Install Django Framework in Ubuntu 20 04   TecAdmin - 85