← Back to Django Course | Chapter 1: Django Fundamentals & Setup | Lesson 3 of 9

Installing Django

Installing Django is like downloading an app on your phone, except you use a special command on your computer.

Checking Python Is Installed

Before installing Django you need Python itself installed, since Django is a Python package; checking the Python version confirms it is ready.

Example: Checking Python Is Installed

Runs the Python version command in the terminal to confirm Python is installed.

bash
python --version

⚠️ Run this command in your terminal.

Installing Django With pip

pip is Python's package installer, and running "pip install django" downloads and installs the latest Django package onto your system or virtual environment.

Note: Always activate your virtual environment first so Django installs there, not globally.

Example: Installing Django With pip

Installs the Django package using pip.

bash
pip install django

⚠️ Run this command in your terminal.

Verifying the Installation

After installing, running "django-admin --version" prints the installed Django version, confirming the installation succeeded.

Example: Verifying the Installation

Prints the currently installed Django version to confirm the install worked.

bash
django-admin --version

⚠️ Run this command in your terminal.

Checking Installed Packages

The command "pip list" shows every package installed in the current environment, which is a quick way to confirm Django appears alongside its dependencies.

Example: Checking Installed Packages

Lists all installed Python packages, including Django, in the current environment.

bash
pip list

⚠️ Run this command in your terminal.

Common Mistakes
  1. Installing Django globally instead of inside a virtual environment, causing version conflicts between projects.
  2. Forgetting to install Python first, since Django requires Python to already be on the system.
  3. Not checking the installed Django version after installation to confirm it worked.
Chapter Summary
  • Django is installed using Python's package manager, pip.
  • You should install Django inside a virtual environment, not globally.
  • The command "django-admin --version" confirms a successful installation.
  • Django requires a compatible Python version to already be installed.

Login to run this code

C/C++/Java/PHP execution requires a free account. Your code is saved — you'll land right back in the editor after logging in.