Installing Django
In this page:
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.
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.
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.
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.
pip list
⚠️ Run this command in your terminal.
- Installing Django globally instead of inside a virtual environment, causing version conflicts between projects.
- Forgetting to install Python first, since Django requires Python to already be on the system.
- Not checking the installed Django version after installation to confirm it worked.
- 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.
Chapter Quiz — Complete all 9 topics to unlock
0/9 topics done
Complete these topics first: