top ad article

By the end of this article, we will have solved the question of how to install Django on Pop!_OS 20.04|20.10|21.04. Django is a free and open source Python web framework that aids rapid development. It handles a lot when it comes to web development, leaving you focused on writing own apps without having to reinvent the wheel. On this tutorial that focuses on how to install Django on Pop!_OS, we will use the Python PIP to install it. PIP is is a package manager that handles packages written in Python. You can learn more about Django and its features on Django website.

Install Django on Pop!_OS 20.04|20.10|21.04

Having seen a brief description of Django on the previous paragraph. It is now about time to focus on its installation. Below is a step by step process that will guide you on how to install Django on Pop!_OS. Stay tuned;

Step 1. Install Python PIP3

To install Python PIP3, then you need to update your system first then install it. Utilize the following commands for its installation;

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

A section of the output is as shown below;

Selecting previously unselected package python3-setuptools.
Preparing to unpack .../6-python3-setuptools_45.2.0-1_all.deb ...
Unpacking python3-setuptools (45.2.0-1) ...
Selecting previously unselected package python3-wheel.
Preparing to unpack .../7-python3-wheel_0.34.2-1_all.deb ...
Unpacking python3-wheel (0.34.2-1) ...
Selecting previously unselected package python3-pip.
Preparing to unpack .../8-python3-pip_20.0.2-5ubuntu1.5_all.deb ...
Unpacking python3-pip (20.0.2-5ubuntu1.5) ...
Setting up python3-setuptools (45.2.0-1) ...
Setting up python3-wheel (0.34.2-1) ...
Setting up libexpat1-dev:amd64 (2.2.9-1build1) ...
Setting up libpython3.8-dev:amd64 (3.8.10-0ubuntu1~20.04) ...
Setting up python3.8-dev (3.8.10-0ubuntu1~20.04) ...
Setting up python-pip-whl (20.0.2-5ubuntu1.5) ...
Setting up libpython3-dev:amd64 (3.8.2-0ubuntu2) ...
Setting up python3-dev (3.8.2-0ubuntu2) ...
Setting up python3-pip (20.0.2-5ubuntu1.5) ...
Processing triggers for man-db (2.9.1-1) ...

You can check the version of PIP installed using the command below;

pip3 -V

The output;

[email protected]:/$ pip3 -V
pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8)

To also know your Python Version, check below;

[email protected]:/$ python3 -V
Python 3.8.10

Step 2. Install Django on Pop!_OS

Once you are done installing the package manager Python PIP3 on the previous step, you can now proceed to install Django on Pop!_OS via PIP using the commands below;

pip3 install --user Django

The output is as shown below, please pay attention to the warning given as it will guide is to the next step;

[email protected]:/$ pip3 install --user Django
Collecting Django
  Downloading Django-3.2.5-py3-none-any.whl (7.9 MB)
     |████████████████████████████████| 7.9 MB 1.5 MB/s
Collecting asgiref<4,>=3.3.2
  Downloading asgiref-3.4.1-py3-none-any.whl (25 kB)
Collecting sqlparse>=0.2.2
  Downloading sqlparse-0.4.1-py3-none-any.whl (42 kB)
     |████████████████████████████████| 42 kB 1.2 MB/s
Requirement already satisfied: pytz in /usr/lib/python3/dist-packages (from Django) (2019.3)
Installing collected packages: asgiref, sqlparse, Django
  WARNING: The script sqlformat is installed in '/home/daylifetips/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The script django-admin is installed in '/home/daylifetips/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed Django-3.2.5 asgiref-3.4.1 sqlparse-0.4.1

To get the global version, use the command;

sudo pip3 install Django

From the warning which I highlighted in red intentionally for you to see, it tells us that Django admin and sqlformat are installed in '/home/daylifetips/.local/bin' which is not a PATH.

To check where Django has been installed, use the command;

which django-admin

The output;

[email protected]:~$ which django-admin
/home/daylifetips/.local/bin/django-admin

Step 3. Add .local/bin to PATH

Now that we know Django has been installed in .local/bin/ which is not in our PATH, you need to add it to PATH. To do so, use nano first to edit the bashrc file, on your command line, type;

nano .bashrc

Then add to path by typing the following command;

export PATH=$PATH:~/.local/bin/

Now that you have successfully added .local/bin to PATH you can now begin using the Django admin. To do so, you need to source .bashrc on the root directory by using the command as shown below and later you can launch it.

source .bashrc

If you are not in the root directory, use;

source ~/.bashrc

To launch Django admin, utilize the command below;

django-admin

Conclusion

By the end of this article, you will have learnt how to install Django on Pop!_OS. You can now proceed to use the Python Web Framework as you wanted. During the installation ensure that you add it to PATH and source the bashrc file to be able to launch django-admin well.

Other Posts;

Previous articleInstall Webstorm on Pop!_OS 20.04|20.10|21.04
Next articleHow to Install AnyDesk on Pop!_OS 20.04|20.10|21.04
Valentine is eager to learn new things, technology and life issues. She is curious enough to write about them. And, she uses her platform to educate others regarding the many sectors in life and most importantly technology.

LEAVE A REPLY

Please enter your comment!
Please enter your name here