Python is one of the most popular programming languages, and there are so many popular frameworks for python but Django is one of the best frameworks for web development. Django is a secure, robust, free, and open-source framework and it works on both Windows and Linux operating systems. Nowadays, Django is becoming so popular among developers.
In this article, we are going to see How to Instal Django on Windows Step by Step with the Command Prompt. After this article, you can able to create Django’s first projects.
Prerequisites:
- Before installing Django on your system, you must make sure that Python Programming is installed on your system, you can check this- How to Install Python on Windows to learn how to do it.
- You must make sure that PIP is installed on your system because we are going to install Django with PIP through CMD or Power Shell.
How to Install Django on Windows Step by Step:
You can use Command Prompt(CMD) or PowerShell for this tutorial but I will highly recommend you to use Command Prompt. All the instructions are given below, so let’s start the article.
Step.1 Install Python & PIP
Make sure that you have installed Python and PIP on your system. You can check How to Install Python on Windows, to learn how to do it. Python and PIP are necessary for installing Django through Command Prompt.
Step.2 Open Command Prompt
First, you need to open Command Prompt on your system. You can do that by searching for Command Prompt in Windows Search Box or you can hold Windows+R Key to open Command
prompt. Now you can see Command Prompt has been opened:
Step.3 Verifying Python Installation
Before installing Django, you need to verify python installation on your computer. To do this, type the below command in your Command Prompt(CMD) and hit the enter button.
python --version
After running this command, you will see output like this else, you need to install Python on your system.
C:\Users\ashis>python --version
Python 3.10.4
C:\Users\ashis>
Python 3.10.4 is installed on my computer when I am writing this article. You might have a different version of python so don’t worry about that. Now we have successfully verified python installation on our computer.
Step.4 Upgrading PIP Version
PIP comes with python default but most of the time, it comes with the older version so Before installing Django on your system, we have to upgrade the PIP version in our system. To do this, type the below command in your command prompt and hit the enter button:
python -m pip install --upgrade pip
Now you will get output like this and you can see that we have successfully upgraded the PIP version on our system.
How to check the version of PIP on windows:
pip --version
You will get output like this:
C:\Users\ashis>pip --version
pip 22.0.4
C:\Users\ashis>
While writing this article, the version of PIP is pip 22.0.4 and it can be different in your case.
Step.5 Installing Django
Now we will see, how to install Django on our system using the PIP method. To do this, run the following command in your Command Prompt(CMD) and hit the enter button.
pip install django
This command line will install the latest version of Django and it will look like this:
Now you can check the version of Django by typing this command in your Command Prompt:
django-admin --version
The output will look like this:
C:\Users\ashis>django-admin --version
4.0.3
Now you can see while writing this article that the latest version of Django is installed in our system. We have successfully installed the Django version in our system.
Step.6 Creating the Django Project
Now you can create Django’s first project through the command line django-admin. To create Django’s first project type the below command in your Command Prompt and then hit the
enter button:
django-admin startproject first_project
first_project is the name of the project, you can give any name that you want to do. This command will create a project with the first_project name. Now move to the first_project folder, so type the below command in CMD and hit the enter button:
Step.7 Running the Development Server
We have successfully created the Django project, now starting the Django development server. To start the Django Development server, type the below command and run it in your cmd in the same folder first_project that we have created.
python manage.py run server
Now go to your browser, visit http://127.0.0.1:8000/ in your web browser. You will see this type of screenshot and it shows that we have successfully created a Django project. Now you are ready to start an app in Django. Best of Luck
Conclusion:
So we have successfully installed Django on windows on our computer or system. You learned how to install Django on Windows, how to upgrade the PIP version on windows, and how to install python in our system. We have successfully created a Django project.
If you have any queries related to this article, then you can ask in the comment section, we will contact you soon, and Thank you for reading this article.
Follow me to receive more useful content:
Instagram | Twitter | Linkedin | Youtube
Thank you