How to Install Django on Windows?

Posted in

How to Install Django on Windows?

Vinay Khatri
Last updated on May 22, 2024

    Django is a powerful and most popular Python web framework . It is used to develop robust and secure web-application. It has more than 52K stars on GitHub, which makes it the second most starred web-framework on GitHub . It is an open-source framework. And with Django, we do not have to worry about the hassle of web-developed; instead, we can focus on the logic of our web-application. Django is a  “Batteries included” framework, which means it comes with many built-in features such as Authentication, Admin, Sessions, and many middlewares. Django is also introduced as a full-stack Python web-framework. It comes with all the dependencies installed, and it can also work with front-end technologies such as HTML, JSON, XML, CSS, and JavaScript. Here in this article, we have mentioned all the steps you need to follow if you want to install Django in your window system.

    Perquisites to install Django

    • Python
    • PIP package manager
    • Internet connection
    • Python virtualenv package (for the virtual Environment)

    Install Django on your Windows System

    There are two approaches to install Django on your window system

    • Install Django for the Complete Python Environment
    • Install Django for the Python virtual environment

    Install Django on windows for the Complete Python Environment

    Step 1:  Install Python and pip

    To install any python library and framework on your Windows system, Python needs to be installed. Django is a python framework, so it requires python-support to run its file on a system. If Python and pip are already installed on your windows, you can jump to Step 2. Installing Python on a windows system is very straightforward. You can visit the official website of Python, , and download the latest version for your window. To know more about how to install Python on windows, click here . Pip is a python package manager, and it is a command tool that can be used to install and uninstall libraries and frameworks for Python. Pip comes along with Python, so you do not have to install it separately. Even if you are getting some problems with pip and Python, click here to know how to install pip on windows . “Note:” Sometimes the python and pip commands do not work on the windows command prompt because the path variable is not set for the python command. Click here to know how to add path variable for Python .

    Step 2: Open Command Prompt

    You can either open the command prompt just by searching for the command prompt on the windows search bar or use the shortcut command CTRL+R and type cmd and hit enter. This will open the command prompt on your window

    STEP 3: Install Django using pip command

    If Python and pip is installed on your windows system, you can easily install the latest version of Django using

    pip install django command

    However, if you do not want to install the latest version of Django, you can specify the Django version you want to install.

    pip install django = <version>

    Note: Make sure that your internet connectivity is on while installing the Django framework. The above pip installs Django command will install Django for your python environment. And the Django package will be stored at the location.


    Step 4: Verify if Django is installed

    To verify if Django is installed on your system, type the following command on your command prompt:

    django-admin --version

    Install Django for a Python virtual environment

    The above installing steps will install the Django for your entire python environment. But if you want to create an isolated new python project where you do not want the already installed python packages affecting the new project. For that, you can create a Python virtual environment and install specific packages for it. Here we have provided the simple steps to guide you through how to install Django in a python virtual environment.

    Step 1: Install Python and pip

    The first step is installing Python and pip command. The pip comes along with Python, so you do not have to worry about installing it. To download Python, you can visit the official website of Python

    Step 2: Open command prompt

    To open the command prompt, you can either search the command prompt on the window search bar. Or use the cmd run command. Use CTRL+R , type cmd and hit enter this will open the command prompt

    Step 3: Create a directory for virtual Environment

    To create a directory using the command prompt, use the command mkdir followed by the directory name. let’s create a directory by name my_django

    mkdir my_django

    The above command will create a directory by the name my_django . Using the cd command, we can change the current directory and go to the my_django directory we just created.

    cd my_django

    Step 4: Install Virtual Environment Package

    Python comes with a package called vritualenv, which is used to create a virtual environment. If virtualenv is not installed in your system, you can use the pip install command to install It.

    pip install virtualenv

    Note: If virtualenv is already installed, you will be getting response Requirement already satisfied:

    Step 5: Create the virtual Environment

    To create a virtual environment, we will use the python venv or virtual environment package. Type the following command to create a virtual environment.

    python -m venv my_virtual_env

    Note : here -m signifies module

    Step 6: Activate the Python Virtual Environment

    Now we need to activate the virtual environment. By activating the virtual environment, the virtual environment name my_venv will prompt at the beginning of the command line. Type the following command to activate the virtual environment.


    Step 7: Install Django

    After activating the virtual environment, using the pip install command, we can install the Django for our virtual environment.

    pip install django

    The above command will install the Django package for the virtual environment at the location


    Step:8 Verify the Django installation

    To verify if Django is installed for your virtual environment, execute the command django-admin --version .

    django-admin --version

    The above command will return the version of the installed Django.

    Note: To get out of the virtual environment, type the deactivate command


    Here in this Python tutorial, you learned how to install Django in windows. Here we have covered two approaches to downloading Django on windows. In the first approach, we covered how we can download Django for the complete python environment. And in the second approach, we provided steps to download Django for a python virtual environment. Often when we create a Django project, we use a virtual environment. This helps in keeping our Django project isolated from the already installed packages. People are also reading:

    Leave a Comment on this Post