Back to Tutorials

Installing Django on Windows

What is a Web Framework?

A web framework is a software platform that provides tools and libraries to simplify web application development. It offers pre-written code for handling common tasks such as URL routing, CRUD (create, read, update, and delete) operations, and user management.

What is Django?

Django is a high-level Python web framework designed for rapid development and clean, pragmatic design. It is dubbed as the web framework for perfectionists with deadlines.

In 2018, I learned about Django back when it was still in version 1.11. I would say Django's official documentation was difficult to grasp at first. However, after understanding its underlying Model-Template-View (MTV) framework, you will appreciate the level of technical detail they have written in the documentation.

Installing Django

1. Activate Your Virtual Environment

Before installing Django, you have to activate your virtual environment. A virtual environment helps isolate your project's dependencies from your global Python installation.

2. Install Django via pip

Once your virtual environment is active, download and install Django using pip by entering the following command in your terminal:

1
pip install django

This command retrieves the Django package from PyPI (Python Package Index) and installs it along with its dependencies. The following are Django’s dependencies: asgiref, sqlparse, and tzdata.

3. Verify that Django is Installed

To ensure Django has been installed correctly, run the following command:

1
pip show django

You should see output similar to this:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
Name: Django
Version: 5.1.4
Summary: A high-level Python web framework that encourages rapid development and clean, pragmatic design.
Home-page: https://www.djangoproject.com/
Author: 
Author-email: Django Software Foundation <foundation@djangoproject.com>
License: BSD-3-Clause
Location: C:\Users\username\gen_emr\gen_emr_venv\Lib\site-packages
Requires: asgiref, sqlparse, tzdata
Required-by: 

4. Confirm Python Can Access Django

Finally, verify that Python can utilize Django by entering the following in your terminal:

1
py

At the Python prompt, try importing Django and printing its version:

1
2
3
>>> import django
>>> print(django.get_version())
5.1.4

If Python returns the installed Django version, you are ready to use Django in your Python project.