Skip to the workspace
Pebellslearn by building
Setting Up: Virtual Environments and Installing Django  ›  Lesson

Installing Django

Installing Django 10 minWith the environment active, pip installs Django from the Python Package Index, and a quick version check confirms which release the project will run.

django / Installing Django

Explore each scene at your own pace.

01 · The rule

The rule

Installing Django

The environment is ready and empty. Now Django itself goes in. It takes one command, but a few seconds of care here, choosing a version and checking where it landed, saves an afternoon of confusion later.

The rule

Activate, install, verify: three commands, always in that order.

Django is published on PyPI, the Python Package Index, and pip fetches it from there. Django 5.x needs Python 3.10 or newer, so check that first:

python --version                             # 3.10 or higher
source .venv/bin/activate                    # 1. activate
python -m pip install "Django>=5.2,<5.3"     # 2. install
python -m django --version                   # 3. verify: 5.2.x

A few details in there matter:

  • python -m pip runs the pip that belongs to the active Python, which removes any doubt about which pip you got.
  • The version range >=5.2,<5.3 means "any 5.2 bug-fix release, but not 5.3". Bug fixes come in; surprises do not. 5.2 is a long-term support release, which gets security fixes for years.
  • The quotes matter: without them the shell reads < and > as file redirects.

Installing Django also brings two small dependencies, asgiref and sqlparse. See everything in the environment with:

pip list

Django also puts a command-line tool on your path, django-admin, which you will use in a moment to create the project.

Scene 1 of 5
Hover to wake the cannons. Drag to move, or use arrow keys when focused. Press Enter to fire a shot.