Complete Django Bootcamp - Tutorial[2]

Django Installation in your System - Tutorial Series [2].

Posted by Shah Stavan on OCTOBER 11 , 2021

How to Install Django in our System? What is Virtual Environment?

by SHAH STAVANOCT 11, 2021

Hey Folks, First of all, if you haven't checked out our Basics of django, check it out now! In this article, we are going to set up Django in our System and what exactly is virtual environment?

What is Virtual Environment?

Normally, what happens when we install Python Libraries it is installed at global level. Now, when we want to install specific packages for our Project we need to install at local level. 

Virtual Environment is an excluding environment provided by Python to work on a particular Project. If you need to install libraries at your project level virtual environment helps a lot.

Setup of Virtual Environment and Django in your System

◼️ First install Python in your System.
◼️ Open CMD.
◼️ Open your Directory in CMD where you want to setup your Project.

$ mkdir project_name

◼️ Change Directory in CMD

$ cd..

$ directory_name: [Example- D: ]

$ mkdir project_name

◼️ Install Virtual Environment using CMD

$ pip install virtualenv

◼️ Activate Virtual Environment. Remember: You should be in your Working Directory.

$ virtualenv env

$ env\Scripts\activate

◼️ Install Django in Virtual Environment.

$ pip install Django

Django Installation

◼️ Check which dependencies or libraries you have installed in your System or at Project level in CMD

$ pip freeze

Default libraries installed while installing Django in virtual env

◼️ When you create a Django Project you must include requirements.txt file in your Project Directory. It enumerates dependencies installed in your Project. 

◼️ Also add python version in your requirements.txt file.

$ pip freeze > requirements.txt

$ notepad requirements.txt

Hope you have enjoyed the Article😉.
In next Tutorial Series we will code our first Hello World Project using Django. So, stay tuned🙌

Goodbye 👋