What is Django?
Django is an open-source Python framework for the web, so anyone can access Django in web development and build web applications from the level of simple to complex applications quickly. Django is fully loaded with tools that are useful for the developers in web application development, such as user authentication and RSS feeds. Django is scalable, therefore, many famous websites are using it as it can handle heavy traffic easily as well as it provides the full security proof plans to manage user accounts and passwords.
In this guide, we are going to explore the installation methods of Django on the latest release of Ubuntu Jammy Jellyfish using the command-line interface.
How to install Django on Ubuntu 22.04
There are two methods to install Django on Ubuntu which are listed below:
- Through the default repository of Ubuntu
- Through the Git repositories
Both the methods are explained in detail in the next sections of this guide.
Method 1: Installing Django on Ubuntu through default repository of Ubuntu
This is the most convenient method to install any packages on Ubuntu, so we will first update all the available packages on Ubuntu repository by using the command:
After updating, we will confirm the installed Python version using the command:
Then we will use the apt package manager to install the package of Django from default repository:
To validate the installation, we will check the version of installed Django using the command:
To remove this installed package of Django use the purge command:
Method 2: Installing Django on Ubuntu through Git repository
The other method to install Django is downloading it from Git repository, for this, we have to install the pip and python management packages by using the command:
Now we will clone the directory of Django from the git repository to our home directory using the command:
Navigate to the cloned directory using the cd command:
Before the installation of Django, we will create the virtual environment “LinuxHint_env” for the Django and also activate the virtual environment “LinuxHint_env” using the command:
Now with the help of pip, we can install Django:
Check the version of installed Django using the command:
Conclusion
Django is a framework for the web developers to build web applications with the code of a few lines so the launch time of the application can be reduced. In this guide, we have explored two different methods of installing Django on Ubuntu, one is from its own repository, and the other is from the git repository.