Chapter 3: Django Getting Started
Django Getting Started step-by-step, like I’m your senior sitting next to you on a shared screen, explaining why we do each thing, what can go wrong (very common in India with different Python installs), and giving real examples.
We’re using the current stable version as of January 31, 2026: Django 6.0.1 It works beautifully with Python 3.12, 3.13, or 3.14 (official support).
Goal today:
- Install everything cleanly
- Create your first project
- Run the magic “It worked!” page
- Understand the folder structure
- Avoid the top 5 beginner mistakes I see in Hyderabad meetups
Step 0: Prerequisites (5–10 min – do this first!)
-
Python installed? Open your terminal (PowerShell / CMD on Windows, Terminal on macOS/Linux) and type:
Bash012345678python --version# orpython3 --versionYou need 3.12 or newer.
- If not → download from https://www.python.org/downloads/ (In 2026, pick Python 3.13 or 3.14 — both fine with Django 6.0)
- Windows tip: Check “Add Python to PATH” during install
- macOS/Linux: Use brew install python@3.13 or apt if needed
-
pip up to date? (very important – old pip causes weird errors)
Bash0123456python -m pip install --upgrade pip -
Code editor
- VS Code (free, best for Django in 2026) + install extensions: Python (by Microsoft), Django (by Baptiste Darthenay), Pylance
- Or PyCharm Community (free) — auto-detects Django projects nicely
Step 1: Create a dedicated project folder (organization matters!)
Don’t code on Desktop or Downloads — future you will thank you.
|
0 1 2 3 4 5 6 |
mkdir my-first-django && cd my-first-django |
(Use mkdir myfirstdjango if you hate hyphens)
Step 2: Virtual environment – never skip this!
Why? Global Python install gets polluted → version conflicts → tears.
Modern way (2026 standard):
|
0 1 2 3 4 5 6 7 |
# Create venv named 'venv' (very common name) python -m venv venv |
Activate it:
-
Windows (CMD/PowerShell):
Bash0123456venv\Scripts\activate -
macOS / Linux / Git Bash:
Bash0123456source venv/bin/activate
You’ll see (venv) appear in prompt → success!
Common mistake: Forgetting to activate → installs packages globally → breaks other projects.
Step 3: Install Django 6.0.1 exactly
|
0 1 2 3 4 5 6 |
pip install Django==6.0.1 |
Why specific version?
- Avoids “works on my machine” issues
- Matches official tutorial for 6.0
Check:
|
0 1 2 3 4 5 6 7 |
python -m django --version # Should output: 6.0.1 |
Step 4: Create your first Django project
|
0 1 2 3 4 5 6 |
django-admin startproject mysite . |
Important: The dot (.) at the end → creates project in current folder (cleaner than nested folders).
Now your structure looks like this:
|
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
my-first-django/ ├── manage.py # Your main command tool ├── mysite/ # The actual project │ ├── __init__.py │ ├── asgi.py # For async (modern) │ ├── settings.py # All config lives here │ ├── urls.py # URL routing table │ └── wsgi.py # For traditional servers └── venv/ |
manage.py is like your project’s remote control.
Step 5: Run the development server – magic moment!
|
0 1 2 3 4 5 6 |
python manage.py runserver |
Or shorter:
|
0 1 2 3 4 5 6 7 |
python manage.py runserver # It auto-starts on http://127.0.0.1:8000/ |
Open browser → http://127.0.0.1:8000/
You should see:
The install worked successfully! Congratulations!
With a big rocket 🚀 and “Django” logo.
→ This page proves: Python → Django → web server → browser all connected!
Press Ctrl + C to stop server.
Step 6: Quick tour of what just happened (the “Aha!” part)
When you visit /:
-
Browser sends GET request to Django
-
Django reads mysite/urls.py (your routing map)
Default looks like:
Python01234567891011from django.contrib import adminfrom django.urls import pathurlpatterns = [path("admin/", admin.site.urls),]No root path → Django shows default welcome page.
-
No database needed yet → pure Python response.
Step 7: Small customization – change welcome message (first edit!)
Open mysite/settings.py
Find:
|
0 1 2 3 4 5 6 |
ALLOWED_HOSTS = [] |
Change to (for local dev only – we’ll secure later):
|
0 1 2 3 4 5 6 |
ALLOWED_HOSTS = ['127.0.0.1', 'localhost'] |
Now create a tiny view.
Create file mysite/views.py (new file!)
|
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
from django.http import HttpResponse def home(request): return HttpResponse(""" <h1 style="color: navy; text-align: center; margin-top: 100px;"> నమస్తే Hyderabad! Welcome to my first Django site 🚀 </h1> <p style="text-align: center; font-size: 1.2rem;"> Built with Django 6.0.1 on Jan 31, 2026 </p> """) |
Now edit mysite/urls.py:
|
0 1 2 3 4 5 6 7 8 9 10 11 12 13 |
from django.contrib import admin from django.urls import path from .views import home # ← import your view urlpatterns = [ path('admin/', admin.site.urls), path('', home, name='home'), # ← root URL '' shows our view ] |
Restart server (python manage.py runserver)
Refresh http://127.0.0.1:8000/ → your custom Telugu + English greeting!
Top 5 mistakes beginners make (and how to fix fast)
- “command not found: django-admin” → Forgot to activate venv or didn’t install Django inside venv
- Port 8000 already in use → Run python manage.py runserver 8001 or kill old process
- TemplateDoesNotExist (later) → Wrong folder structure — templates must be in right place
- ModuleNotFoundError: No module named ‘mysite’ → Ran commands outside project folder or wrong cd
- Windows path issues → Use python not py, or add to PATH properly
What next? (Your homework / our next session)
You now have a running Django project!
Options:
- Follow official poll tutorial (Part 1–7) → best structured learning → https://docs.djangoproject.com/en/6.0/intro/tutorial01/
- Add a simple templates folder + HTML page (more beautiful than HttpResponse)
- See the famous admin panel (/admin/ → create superuser)
- Or build a mini “Hello + current time” dynamic page
Tell me what you want next:
- “Let’s do the official poll tutorial step by step”
- “Show me how to add HTML templates properly”
- “How to use Django admin right now”
- “I got an error — here it is…”
I’m here — let’s keep building! 💻🇮🇳
