Django Get Started
Setting up your Django development environment
🚀 Getting Started with Django
Begin your Django journey by setting up the development environment. This guide walks you through checking Python installation, understanding prerequisites, and preparing your system for Django development.
# Check if Python is installed
python --version
# Expected output
Python 3.11.0
Output:
Python 3.11.0
Prerequisites
Python 3.8+
Django requires Python 3.8 or higher
python --version
pip
Python package installer
pip --version
Code Editor
VS Code, PyCharm, or any text editor
Terminal/Command Line
Access to command line interface
🔹 Step 1: Check Python Installation
Before installing Django, verify that Python is installed on your system. Open your terminal or command prompt and run the version check command to confirm Python 3.8 or higher is available.
# Windows
python --version
# Mac/Linux
python3 --version
# Check pip installation
pip --version
# or
pip3 --version
Expected Output:
Python 3.11.0
pip 23.0.1 from /usr/local/lib/python3.11/site-packages/pip (python 3.11)
🔹 Step 2: Install Python (If Needed)
If Python is not installed, download and install it from the official website:
Installation Steps:
- Visit python.org/downloads
- Download Python 3.11 or later
- Run the installer
- Important: Check "Add Python to PATH" during installation
-
Verify installation with
python --version
# After installation, verify:
python --version
pip --version
# Update pip to latest version
python -m pip install --upgrade pip
🔹 Step 3: Choose Your Code Editor
Select a code editor for Django development. Popular choices include Visual Studio Code with Python extensions, PyCharm Community Edition, or Sublime Text with Python packages for syntax highlighting and code completion.
🔸 Visual Studio Code (Recommended for Beginners)
- Free and Open Source
- Python Extension: Install from VS Code marketplace
- Django Extension: Syntax highlighting for templates
- Integrated Terminal: Run commands without leaving editor
🔸 PyCharm Community Edition
- Python-Specific IDE
- Django Support: Built-in Django features
- Debugging Tools: Advanced debugging capabilities
- Code Completion: Intelligent code suggestions
🔹 Step 4: Understanding the Workflow
Here's the typical Django development workflow:
# 1. Create a project directory
mkdir myproject
cd myproject
# 2. Create virtual environment (next lesson)
python -m venv venv
# 3. Activate virtual environment
# Windows:
venv\Scripts\activate
# Mac/Linux:
source venv/bin/activate
# 4. Install Django (next lesson)
pip install django
# 5. Create Django project
django-admin startproject mysite
# 6. Run development server
cd mysite
python manage.py runserver
Output:
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
🔹 System Requirements
Ensure your system meets these minimum requirements:
Minimum Requirements:
- Operating System: Windows 10+, macOS 10.14+, or Linux
- Python: Version 3.8 or higher
- RAM: 4GB minimum (8GB recommended)
- Disk Space: 500MB for Django and dependencies
- Internet: Required for package installation
🔹 Quick Setup Checklist
Complete this checklist before proceeding:
✅ Pre-Installation Checklist:
- ☐ Python 3.8+ installed and verified
- ☐ pip package manager working
- ☐ Code editor installed and configured
- ☐ Terminal/Command prompt accessible
- ☐ Basic Python knowledge
- ☐ Internet connection available
# Run these commands to verify everything:
python --version # Should show Python 3.8+
pip --version # Should show pip version
python -m pip list # Shows installed packages