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 |
|
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 |
|
You should see output similar to this:
1 2 3 4 5 6 7 8 9 10 |
|
4. Confirm Python Can Access Django
Finally, verify that Python can utilize Django by entering the following in your terminal:
1 |
|
At the Python prompt, try importing Django and printing its version:
1 2 3 |
|
If Python returns the installed Django version, you are ready to use Django in your Python project.