Django — Installation
Requirements
- Python 3.8 or higher
- pip (Python package manager)
- Database (SQLite included)
Install with pip
pip install django
Install Specific Version
pip install django==5.0
Verify Installation
python -m django --version
Virtual Environment
# Create
python -m venv venv
# Activate Windows
venv\Scripts\activate
# Activate macOS/Linux
source venv/bin/activate
# Deactivate
deactivate
Requirements File
pip freeze > requirements.txt
pip install -r requirements.txt
Database Setup
# SQLite (default, no setup needed)
python manage.py migrate
# PostgreSQL (requires psycopg2)
pip install psycopg2
# Update settings.py DATABASES
Environment Variables
# settings.py
import os
SECRET_KEY = os.environ.get('DJANGO_SECRET_KEY')
DEBUG = os.environ.get('DEBUG', 'False') == 'True'
Mini Practice
- Install Django in a virtual environment
- Create a requirements.txt
- Set up environment variables
- Run migrations
Up Next
Continue with Project — creating Django projects.
Related Topics
Frequently Asked Questions about Installation
What is Installation in Django?
Installation is a fundamental concept in Django. This lesson explains it step by step with clear examples, making it easy for beginners to understand.
How do I learn Installation?
Start by reading the explanation above, then try the code examples. Practice by modifying the examples and experimenting with different values. Hands-on practice is the best way to learn Installation.
Why is Installation important in Django?
Installation is essential for Django development. Understanding this concept will help you write better code and solve real-world problems more effectively.