How to Install DJango on Windows - PC Hover Guide

pro django book on a table with a keyboard

Wanna to Install Django on windows? If yes then here is the detailed guide on how to install Django on a Windows machine. Django is one of the most popular web development frameworks in Python and developers love this framework. It is secure, dynamic, robust, and allows developers rapidly to develop their projects and meet deadlines.

It is an open-source and free-to-use platform and works on Windows and nix systems. In this tutorial, we are going to learn how to install Django on a Windows machine.

Install Python on your computer first

Firstly you will have to install Python on your computer before you install Django on your windows computer. We have a detailed guide on how to install python on windows you can check it out if you haven't installed Python your windows.

Install Django on Windows

The commands in this tutorial will work on both Windows command prompt and Powershell. We will be using powershell but you can use CMD.


Step 1 - Open Powershell

Search for the PowerShell on your windows computer - open the Run dialog box by pressing the Windows logo key + R(Win + R) and type PowerShell and then click on the OK button.

Powershell is opened now we will check that Python has been installed or not.


Step 2 - Verify Python Installation

Type Python -V on the PowerShell to verify that Python is installed or not.

You will see the Python version installed on your machine.


Step 3 - Upgrade to Pip

Python comes with the Pip by default, but most of the time it comes with an old version. It is recommended to upgrade to the latest version. You will see the below screenshot window after the successful update of the Pip.


Step 4 - Create a Project Directory

Now let's create a new project directory and name it django_project. It is a demo project but in the real world, the project directory will be named as a blog, forum, etc.

To create the directory:

> mkdir django_project

Change into the django_project directory:

> cd django_project

Your prompt window will show you that you are in the django_project and will look like this:

PC C:\Users\Username\django_project>


Step 5 - Create a virtual environment

A VE(virtual environment) is an isolated Python environment where you can install the packages and dependencies without affecting the other Python projects. Learn more about Python virtual environment here.

To create a virtual environment type python -m venv venv and wait for few seconds.

> python -m venv venv

This command will create a directory called venv in the project directory.

Now we will activate the Python virtual environment


Step 6 - Activate the Virtual Environment

To activate the virtual environment run the following command.

> venv\Scripts\activate

When the virtual environment is activated you will see a venv at the beginning of the prompt.

(venv) PC C:\Users\Shubham\django_project>

Now the virtual environment has been activated, now let's install Django on our computer.


Step 7 - Install Django on the computer

We will be using pip to install Django. So to do that run the following command to start the installation process.

(venv) pip install django

The command will now install the latest version of Django. You will see that Django is being downloaded and installed:

In case you want to install a different Django version on your PC then you can also specify that:

(venv) pip install django==2.1


Step 8 - Start your new project

I will use the Django-admin to start a new project to create our new Django project structure called "test site".

Run the following command:

(venv)> django-admin startnewproject tetsite

Navigate into the test site directory by running the command - 

(venv) cd testsite


Step 9 - Now Run the server

Now let's run the development server by using the manage.py runserver command.

(venv)> python manage.py runserver

Now you have successfully installed Django on your windows computer.

If you want to leave the virtual environment then type deactivate on the prompt and now you are ready to start developing your new project.


Post a Comment

0 Comments