Loading lesson path
Overview
Now, that we have created a virtual environment, we are ready to install Django.
Remember to install Django while you are in the virtual environment! Django is installed using pip, with this command: (myworld) ... $
Formula
python - m pip install DjangoWhich will give a result that looks like this (at least on my Windows machine):
Formula
Downloading Django - 5.1.7 - py3 - none - any.whl.metadata (4.1 kB)
Collecting asgiref < 4,>= 3.8.1 (from Django)
Downloading asgiref - 3.8.1 - py3 - none - any.whl.metadata (9.3 kB)Collecting sqlparse>=0.3.1 (from Django)
Formula
Downloading sqlparse - 0.5.3 - py3 - none - any.whl.metadata (3.9 kB)Collecting tzdata (from Django)
Formula
Downloading tzdata - 2025.1 - py2.py3 - none - any.whl.metadata (1.4 kB)
Downloading Django - 5.1.7 - py3 - none - any.whl (8.3 MB)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Formula
8.3/8.3 MB
36.4 MB/s eta0:00:00
Formula
Downloading asgiref - 3.8.1 - py3 - none - any.whl (23 kB)
Downloading sqlparse - 0.5.3 - py3 - none - any.whl (44 kB)
Downloading tzdata - 2025.1 - py2.py3 - none - any.whl (346 kB)Installing collected packages: tzdata, sqlparse, asgiref, Django
Formula
Successfully installed Django - 5.1.7 asgiref - 3.8.1 sqlparse - 0.5.3 tzdata - 2025.1[ notice ] A new release of pip is available: 24.3.1 -> 25.0.1 [ notice ] To update, run:
Formula
python.exe - m pip install -- upgrade pipThat's it! Now you have installed Django in your new project, running in a virtual environment! Windows, Mac, or Unix? You can run this project on either one. There can be some small differences, like some Windows versions prefers py as the first word in the command line, instead of python
python --version In the rest of this tutorial, we will be using Windows commands with the python keyword.
You can check if Django is installed by asking for its version number like this: (myworld) C:\Users\
>
Formula
django - admin -- version
If Django is installed, you will get a result with the version number:5.1.7
Now you are ready to create a Django project in a virtual environment on your computer. In the next chapters of this tutorial we will create a Django project and look at the various features of Django and hopefully make you a Django developer.