In this tutorial, you will learn how to install Django on Windows & ubuntu step by step. Also, you will know to create Django Project globally or in a Separate Virtual Environment.
If you are going to develop a project using Django Framework, then you will have to install Django in your system. After that, you can easily create a Django project and work with its applications & files
Install Django in Global & Virtual Environment
Before installing Django, make sure that It is already installed in your system or not using the command
django-admin --version
If you find Django is not installed, then you can install it in two ways first one virtual environment & second one Globally. These ways are explained step by step in the upcoming steps
Requirements –
Before installing Django, make sure the following thing must be installed in your system
Python 3.0 or greater -You can download python from its official website python.org. If you already installed it, you can check its version by running the command.
python --version
PIP – It is included with python v3.x or higher. So, you need not to install it, but you can check it’s version by running command.
pip --version
Code Editor – You should use visual studio code editor. otherwise you can use another one
Web Browser – You should use Chrome Browser. otherwise you can use another one.
Install Django in Virtual Environment
If you need to install django seperately in your system then you can follow these steps
1. Install Virtual Environment Wrapper
Run this command to install virtual Environment Wrapper
pip install virtualenvwrapper-win
2. Create Virtual Environment (VE)
Then run this command to create virtual Environment
make virtualenv envname
3. Active Virtual Environment
Virtual Environment is automatically activated. If is not then you can run this command
workon envname
4. Install Django in Vertual Environment
After that, run this command to install Django in virtual Environment
pip install django
Note –
You can check the installed Django in virtual environmenr, you will have to run the following command.
First of all, run –
workon codingstatus
Where codingstatus is the name of virtual environment
then run –
django-admin --version
Install Django Globally
If you need to install Django globally in your system then you can just run this command only
pip install django
How to Install Django on windows
Globally –
just run this command in your terminal to install django globally on windows
pip install django
In Virtual Environment –
- Open your terminal in your system
- Installed virtual environment wrapper using command pip virtualenvwrapper-win
- Create a virtual environment using the command make virtualenv environmentName
- then active virtual environment using command workon environmentName
- after that install Django using pip install django
How to install Django on Ubuntu
Globally –
just run this command in your terminal to install django globally on ubuntu
sudo pip install django
In Virtual Environment –
- Open your terminal in your system
- Installed virtual environment wrapper using command sudo pip virtualenvwrapper-win
- Create a virtual environment using the command sudo make virtualenv environmentName
- then active virtual environment using command sudo workon environmentName
- after that install Django using sudo pip install django
What Next?
I will share next article on How to Create Django Project as soon as possible.
If you like this article and you want more Django tutorials, then do comment and also share with your friends