Menu Close

Django installation in Python

Django Installation in Python

Hello Python programmers, In this article we are going to see how to install Django in Python with the help of the Python pip command. The process of installation will be the same in all the operating systems like Windows and Linux.
In the previous tutorial, we have seen the introduction of the Django web framework. In this guide, we will only see the installation of Python Django.

Here Django installation in Python will be completely inside Python’s virtual environment. Firstly we will talk about Python virtual environment.

Python Virtual Environment

A virtual environment in Python is the concept of creating an insolate Python environment that will be completely different from the global Python environment. We can install and remove any Python packages inside Python virtual environment. All the Python environments run independently.

Creating Python Virtual Environment

Here we will create a Python virtual environment on a Windows machine. Python has a built-in module venv that is used to create an isolated Python environment.

python -m venv venv_name

Above all venv_name represents the name of the Python virtual environment.

Creation of Python virtual environment in Linux base machine, The above command will be same.

Activate Virtual Environment

Activation of the Python virtual environment will be different in both of the operating machines.

Windows

The issue below command to activate Python virtual in windows machine.

venv\Scripts\activate

Linux Machine

The issue below command to activate Python virtual environment in Linux machine.

source venv/bin/activate

Installing Django

Now it’s time to see Django installation in Python. The process of Django installation in ubuntu ( Linux ) and Django installation in windows will be the same.
Issue the following command to install Django.

pip install django

This command will automatically download and install the latest version of the Django web framework in your isolated python virtual environment.

To verify whether Django is installed in your system or not, issue the below command to see the Django version.

django-admin --version

Conclusion

So in this article, we have seen all about how Django installation in Python inside Python virtual environment.

Python virtual environment is one of the best and most popular ways to isolate Python projects. I hope you don’t have any confusion regarding Django installation in python.

In the next tutorial, we will see how to create the first Django project and an explanation of the Django project structure.

Thanks for reading ….

Next Article

Related Posts