Chapter 2: Django Introduction
Django Introduction: I’m going to explain Django to you exactly the way I would explain it to my cousin who’s just finished learning basic Python and wants to build real websites. No copy-paste from docs — pure human-teacher style with examples, analogies, why-things-are-done-this-way, and small code snippets to make it stick.
1. First big question — What actually is Django?
Imagine you’re building a house.
- If you use only bricks, cement, sand → very slow, you make every wall, door, window from scratch → that’s like writing a website using pure Python + HTML + HTTP server code.
- If you buy a pre-made modular house kit (walls, plumbing, electrical already designed) → much faster, but you still customize paint, furniture → that’s Flask (very lightweight Python web framework).
- Now imagine you get a fully furnished apartment complex with:
- Ready security guard (authentication)
- Automatic water/electricity billing (admin panel)
- Pre-designed lifts & corridors (URL routing)
- Built-in strong room for valuables (ORM + migrations)
- And the builder says: “Just tell me how many bedrooms and what color — rest I handle”
That’s Django.
Official one-liner (Jan 2026):
Django is a high-level Python web framework that encourages rapid development and clean, pragmatic design.
But in simple words:
Django = batteries-included Python toolkit that lets you build serious, production-ready websites very quickly — while keeping your code organized and secure almost automatically.
2. Who created Django and why? (The origin story — important!)
Year: 2005 Place: Lawrence Journal-World newspaper, Kansas, USA
Journalists needed to publish news + interactive features (polls, comments, sports scores) very fast — deadlines were brutal.
They were using PHP but hated rewriting login systems, database connections, HTML escaping every time.
So two developers (Adrian Holovaty + Simon Willison) started writing reusable code → that became Django.
Released as open-source in 2005 → named after Django Reinhardt (jazz guitarist — because they liked jazz and wanted something “playful yet powerful”).
Today (Jan 2026):
- Latest stable version → Django 6.0.1 (released Dec 2025 / Jan 2026 patch)
- Supports Python 3.12, 3.13, 3.14
- Used by: Instagram, Pinterest, Disqus, Bitbucket, Mozilla, Eventbrite, Washington Post, and thousands of startups in India too (Zomato early days, Cred, Razorpay parts, etc.)
3. The famous Django slogan — “The web framework for perfectionists with deadlines”
Perfectionists → clean, readable code (forces good structure) Deadlines → very fast to build real features
It achieves this with four big philosophies:
| Philosophy | What it really means (human words) | Example benefit |
|---|---|---|
| DRY | Don’t Repeat Yourself — write once, reuse everywhere | One place to change password reset logic |
| “Batteries included” | Comes with almost everything you need for 80–90% of websites | Built-in admin panel, forms, auth, sessions, etc. |
| MTV / MVT | Model-Template-View (Django calls it MVT) — clear separation of concerns | Easier to maintain large projects |
| Explicit is better than implicit | You see exactly what’s happening — no magic unless you want it | Easier debugging than some other frameworks |
4. What kind of things can you build with Django?
Real-world examples (2026 perspective):
- News portals / blogs (Washington Post style)
- Social features (Instagram was originally Django-only)
- E-commerce (not full Shopify, but custom stores)
- Dashboards / internal tools (many Indian fintechs)
- APIs (with Django REST framework — super popular)
- Learning platforms (like early versions of Unacademy parts)
- Job boards, forums, event management
- Anything that needs users, login, database, forms
Not ideal for → ultra-high-frequency trading apps, real-time games (better with FastAPI + WebSockets or Node.js), very tiny microservices (Flask/FastAPI lighter)
5. How Django actually works — high-level flow (very important diagram in words)
User types → yoursite.com/polls/5/vote/
-
Web server (nginx/Apache in production, or runserver in dev) receives request
-
Passes to Django (via WSGI/ASGI)
-
Django looks at urls.py (your mapping table)
Python01234567# example mysite/urls.pypath('polls/<int:pk>/vote/', views.vote, name='vote') -
Finds matching view function/class → calls it
-
View usually:
- Talks to Model (database via ORM)
- Prepares data
- Sends to Template (HTML + Jinja-like logic)
-
Template renders → beautiful HTML
-
Django sends response back → user sees page
Magic parts Django handles for free:
- Escaping HTML/JS to prevent XSS
- CSRF protection on forms
- Session management
- 404/500 pages
- Static files serving (dev mode)
- And the killer → automatic admin interface
6. Mini live example — what a tiny Django “Hello World” looks like
(We did this earlier, but let’s see it again with comments)
|
0 1 2 3 4 5 6 7 8 9 10 |
# polls/views.py from django.http import HttpResponse def say_hello(request): return HttpResponse("<h1>నమస్తే Hyderabad! Welcome to Django 6.0 🚀</h1>") |
|
0 1 2 3 4 5 6 7 8 9 10 11 12 |
# polls/urls.py from django.urls import path from . import views urlpatterns = [ path('hello/', views.say_hello), ] |
|
0 1 2 3 4 5 6 7 8 9 10 11 |
# mysite/urls.py from django.urls import include, path urlpatterns = [ path('polls/', include('polls.urls')), ] |
→ Visit /polls/hello/ → you see Telugu + English greeting 😄
This tiny example already shows:
- Separation (views know logic, urls know routing)
- Request object available (you can read GET, POST, cookies…)
- Easy to grow
7. Why beginners in India (especially Hyderabad) love Django in 2026
- Python is already popular in data science / automation → natural next step
- Huge job market — Django + DRF jobs everywhere (TCS, Infosys, startups)
- Free hosting easy (Railway, Render, Fly.io, Railway.app has free tier)
- Community strong — Django Hyderabad meetups still active
- Works beautifully with PostgreSQL (free on Supabase/Neon)
- Admin panel saves weeks of work for internal tools
Quick self-check questions (think before scrolling)
- Is Django frontend or backend? → Backend (but can serve HTML + use HTMX/Alpine for modern feel)
- Do I need JavaScript? → For simple sites → no. For SPA → yes (React/Vue + Django API)
- Can I learn Django without HTML/CSS? → Not really — you need basics
- Is Django 6.0 very different from 4.2 / 5.0? → No — upgrade is usually smooth
Ready?
Next natural step → actually install and create first project.
Tell me:
- Want full step-by-step installation again (with venv, VS Code tips for Hyderabad power cuts 😅)?
- Or jump to “What is Model-View-Template exactly” with pictures in mind?
- Or straight to building a mini to-do list instead of polls?
Your call — I’m your personal Django guru today! 🚀
