If you are new to Django, good news! Youâve found the most complete and comprehensive guide on how to install Django on your Windows computer. I will start with some software and tools needed before you can install Django on Windows, then into virtual environments, and ultimately into how to install Django step by step on Windows operating system. Hopefully, by the end of this post, youâll have learned how to install the web development framework on your Windows computer and youâd be ready to start building your first Django project. Make sure to always come back to this post for your future Django projects. It always will be there for you.
Now letâs get into it.
Table of Contents
- Hold Up! Before You Install Django on WindowsâŠ
- How To Install Django On Windows.
- Step 1: Create a folder and name it the project name.
- Step 2: Open your terminal and Cd (Change directory) into your project folder
- Steps 3-5: Create a virtual environment, Activate It and Install Django.
- How To Create A Virtual Environment With Virtualenv.
- How To Create A Virtual Environment With Pipenv.
- Bonus Tips and Tricks On How To Install Django On Windows.
- Next Steps After Installing DjangoâŠ
This is a guide for Django beginners, it assumes that you are installing Django on Windows for learning purposes and not for production purposes. Therefore third-party web servers and databases are beyond the scope of this guide. This guide is also intended for Windows users but one from a different operating system can follow along without any problems. At least for the most part.
Hold Up! Before You Install Django on WindowsâŠ

Django is a web development framework built on the Python programming language, which means it needs Python for it to work. All the models and views and URLs youâll write in Django youâll write them in Python. With that being said, you first need to install Python on your machine before you install Django.
How To Install Python On Windows from Its Official Site.
One of the safest methods to install Python on Windows is to download it from its official website. Follow the steps below to download and install Python on Windows.
- Start by checking if Python is already installed on Windows or not. If the version is not up to date upgrade it and if it is up to date, jump to the How To Install Django on Windows section. If it is not installed move to the next step.
- Open your browser and Go to https://www.python.org/
- Hover over the Downloads link on the Navigation and click on the âPython [version]â button. As of the writing of this post, the latest Python version is 3.10.5. It may be a bit different from what youâll get. Donât worry about it, just go ahead and press the button.
- The Python Installer will start downloading on your Windows machine. Depending on the browser youâre using, you may be prompted to choose a location where you want the installer to be saved. Go ahead and choose one. The Downloads folder will be the most suitable location on Windows.
- Locate the Installer from where it has been saved. Itâs most probably the Downloads folder. It should be named something like âpython [version]â with the Python logo icon.
- Double click the Python Installer to start installing Python on your Windows computer.
- On the Setup window that opens, check the âAdd Python [version] to PATHâ checkbox at the bottom. This is very important, make sure you do it!
- Now click on the âInstall Nowâ section. As you can see, this installation will install other dependencies like pip that will help us in the installation of Django later in the future. (For some users, a User Account Control window may popup for confirmation of the installation)
- Wait for the Python Installation to finish.
Was the installation successful? Good, now close the window, and letâs move on to the next step in the installation of Django on Windows.
How To Install Python On Windows from Microsoft Store.
Another way to install Django on Windows is to do so via Microsoft Store. This method is relatively faster than the one above because you donât need an installer.
- Open Microsoft Store.
- Search for âpythonâ on the search bar.
- On the results that yield, click Python.
- On the Python detail page, click the Get button.
- Wait for the python to install. Microsoft Store will notify you once itâs done.
- Verify if Python has been installed correctly.
The installation of Python is a one-time installation and you donât have to do it every time you want to start a Django project. This is because Python is installed globally into the system of your computer while Django may need to be installed in a virtual environment. Speaking of virtual environments, a virtual environment creation tool happens to be the next thing that we need to install on Windows before we can install Django.
How To Install Virtual Environment Tools:

A virtual environment is literally an environment that is virtual. Among others, one of the benefits of virtual environments is that they isolate your project and its dependencies from the system of the computer so that they cannot interfere with each other. Letâs say youâre creating two Django projects at the same time but they use different Django versions. It will be ideal to install a different Django version for another project and a different one for the other.
In the Python world, there are two very popular virtual environment tools: virtualenv and pipenv. I will show you how to use both, and Iâll also show you the one I like and why I do. Youâre free to choose the one thatâs good for you based on the examples Iâll offer.
This section will only focus on their installation not use, in order to decide, you might need to check the next section on installing Django in a virtual environment to see how each one of them works. You cannot use both!
How To Install virtualenv on Windows
Virtualenv is a bit older than pipenv, but it works best on Windows. I think it is the best virtual environment tool for Windows. Virtualenv creates a folder where all your dependencies will be installed.
To install virtualenv on Windows, run the following command in your Windows terminal tool.
Command Line
$ pip install virtualenv
If this code runs successfully, then virtualenv will be installed and you are now ready to use it to install Django. You can learn more about virtualenv here.
How To Install pipenv on Windows
Another alternative virtual environment tool to virtualenv is pipenv. Unlike virtualenv, pipenv creates two files, a Pipfile
and a Pipfile.lock
. The former contains software dependencies while the latter makes sure that builds are deterministic.
Below is how to install pipenv on Windows.
Command Line:
$ pip install pipenv
Those where the virtual environments for Windows. Remember, you only need one. Now lets move on to the next section and see how these virtual environments are used to install Django.
How To Install Django On Windows.

We have finally reached the part where we all have been waiting for, the part where we learn how to install Django on Windows. You have to keep in mind that the installation of Django has to be done every time you start a new Django project because youâll be installing it inside a virtual environment. You can also install Django globally for practice purposes but it is always best to do the best practices right from the start.
Since we are using two different virtual environments, Iâll illustrate how to install Django using both of them. But for the most part, the steps are the same so let me just start by outlining those steps.
- Step 1: Create a folder and name it the project name.
- Step 2: Open your terminal and Cd (Change directory) into your project folder.
- Step 3: Create a virtual environment using virtualenv or pipenv.
- Step 4: Activate the virtual environment.
- Step 5: Install Django in the activated virtual environment.
All Done! These are the five steps you need to take to install Django.
Letâs get into the details.
Step 1: Create a folder and name it the project name.
You first need to create a folder where your project and virtual environment will be located. Letâs use an example of a to-do website. If youâre creating a to-do website, you may want to name the folder todoapp
or todosite
or djangotodo
. Just name it something that best explains your projects in a very few letters.
I store my Django projects in the following folder:
Documents>> SoftDev>> Projects>> Django
So what Iâd do is navigate to the Django folder and create a new folder with the name of my project. You donât really have to be as organized as this. You can simply create yours on the Desktop.
Some will prefer to do it on the command line.
Command Line (example code)
$ cd documents\softdev\projects\django
$ mkdir todoapp
If you used the command line do not close the terminal or change it for youâll use it in the next section.
Did you create a folder in your favorable location and named it your project name? Good! Now it is time to get (cd) into that folder and create a virtual environment.
Step 2: Open your terminal and Cd (Change directory) into your project folder
We are going to create a virtual environment inside the folder you created in step 1. Since we are doing it through the command line, you first need to cd into that folder. cd stands for change directory.
Continuing from the above example. If you had already got into the direct parent of the project folder and you had not closed the terminal. simply cd into the project folder:
$ cd todoapp
If youâre not in the direct parent folder:
$ cd documents\softdev\projects\django\todoapp
A quick method is to navigate into the project folder from your file explorer and then click inside the path section and copy the path. Paste the path next to cd
in the terminal.
Are you now in the project folder on your terminal? Good! Itâs now time to create a virtual environment inside that folder.
Steps 3-5: Create a virtual environment, Activate It and Install Django.
This is where the steps divert. With virtualenv, you start by creating the virtual environment itself and then activate it. Itâs only after then that you can install Django. On the other hand, with pipenv, Django is installed during the creation of the virtual environment. Then you can activate it.
How To Create A Virtual Environment With Virtualenv.
Below are the steps to creating a virtual environment with virtual env.
âMake sure, on your terminal, youâre in the folder you want to create the virtual environment. The project folder. Refer to the previous step to learn how to do it.
âIn that folder, run the following command.
$ virtualenv env
The env
at the end is the name of the virtual environment. Three names are usually used for virtual environments namely env
, venv
and .env
. You can use one that suits you best. Now after the above command runs, you should see a folder inside your project folder with the name youâve given to the virtual environment. Thatâs your virtual environment.
Double click the folder to open it. There should be some other folders inside. Double click the Scripts
folder. Inside there, youâll find a file called activate.bat. That file is the one that contains the code to activate the virtual environment. Now, all we have to do is to open the file via the terminal in order to activate the virtual environment.
âRun the following command to activate the virtual environment:
$ .\env\scripts\activate.bat
The .
represents âcurrent folderâ, in this case, itâs the project folder. env
is the name of your virtual environment.
Once that command has run. There should be some brackets at the start of your terminal with the name of the virtual environment to indicate that the virtual environment is now active. Something like below.
(env) $
Thatâs the one thing I prefer virtualenv over pipenv. Unlike pipenv, it shows you when the virtual environment is activated. Pipenv, on the other hand, does not on the Windows operating system. This can really be problematic since it has the potential to bring mistakes.
For Mac and Linux users, pipenv is perfectly fine. But for Windows, I donât recommend it for that reason. Anyway, Iâll show you how to use it in case youâre interested.
âNow it is time to install Django in the activated virtual environment.
Run the following command:
$ pip install django
Thatâs it. After this command finishes running, Django will be installed in the virtual environment and ready to start its use. Inside env\libraries\ is where youâll find Django and its dependencies. Take a look at whatâs installed. This will install the latest Django version. Check out how to install a specific version if you want to do so.
This concludes our section on how to install Django on Windows using virtualenv. Lets get into an alternate universe of pipenv.
How To Create A Virtual Environment With Pipenv.
Although there is that given drawback about pipenv, itâs easier to use than virtualenv as you only need two commands to create, activate it, and install Django.
Follow the steps below to install Django using pipenv.
âMake sure, on your terminal, youâre in the folder you want to create the virtual environment. The project folder. Refer to the previous step to learn how to do it.
âRun the following command:
$ pipenv install django
This is the killer command that creates both creates the virtual environment and installs Django in it. If you look into the project folder there are two files, a Pipfile
and a Pipfile.lock
. Pipfile
, among other dependencies, is where Django is installed. This will install the latest Django version. Check out how to install a specific version if you want to do so.
âActivate the virtual environment using the command below.
$ pipenv shell
That does the job. Unfortunately, you wonât be able to verify if it is active or not if youâre on a Windows computer.
Bonus Tips and Tricks On How To Install Django On Windows.
How To Install Django Globally On Windows.
Installing Django globally simply means youâre installing Django for the whole system so that you wonât have to install it every time you start a new Django project. This is not a best practice but if youâre doing it for practice purposes, it should not be a big deal.
Run the following command on your Windows terminal to install Django globally. Make sure youâre not in an active virtual environment.
$ pip install django
The simplest way to check if Django is installed correctly is to just check the Django version. Run the following command to do so.
$ python -m django --version
-m represents âmoduleâ. That command should return the Django version that is installed and you know that youâve installed Django correctly on Windows.
How To Install A specific version of Django.
As of the writing of this post, the latest Django version is Django 4. You may want to install a minor version of Django. Here is how to do it.
$ pip install django~=3.9.0
3.9.0 is the version of Django you want to install. This works whether youâre installing it in a virtual environment or not.
For pipenv. Do the following:
$ pipenv install django~=3.9.0
How To Uninstall Django From Windows.
If you have installed Django globally, run the following command on your Windows terminal to uninstall it.
$ pip uninstall django
Proceed (Y/n)? $ y
Did it uninstall successfully? Now verify that by running the command that checks for the Django version installed. All the ultimate command that lists out all the folders with Django:
$ pip show -f django
You should get some kind of error to show that Django is no longer on Windows.
How To Check if Python Is installed correctly On Windows.
To check if Python is installed on Windows, run the following command on your windows terminal.
$ python
If Python is installed, the terminal will print out it version and something like this after: Type "help", "copyright", "credits" or "license" for more information.
If it is not, good thing, Windows will open Microsoft Store to where you can download Python from. Follow the second Python installation method if you cannot walk yourself through. After installation, always run the above command to check if Python has now been installed.
Next Steps After Installing DjangoâŠ
Were you able to download and install Python, did you choose the virtual environment that is best for you, and were you able to install it on Windows, did you manage to create a virtual environment with it and ultimately install Django? If you answered yes to the questions above, congrats, you now know what it takes to install Django on Windows and how to do it the best way possible.
After installing Django on Windows, it is now time to start building your first Django project. You may need to find some guides on how to start a Django project or some best books to learn Django. Even some best Python books to brush up your python skills before you get deep into Django.
Let me know what you think about this post down in the comments section below. If you found it helpful, please share it with others that you think may need it. Iâll see you in other Coding Gear guides. Peace.