Djangoweb developmentPython

Django for beginners: what the framework actually does for you

A plain-English walkthrough of Django's project structure, request flow, ORM, and admin — with honest notes on where it stumbles.

WebPrims Team9 September 20266 min read
Django for beginners: what the framework actually does for you

A student in our spring batch spent three weeks building a blog in Flask. Routes, sessions, a database connection string, manual form validation — he did it all by hand. Then he rebuilt the same blog in Django over a weekend. Same features. The Django version had less code, fewer bugs, and a working admin interface he hadn't even planned for. He wasn't faster because Django is magic. He was faster because Django had already solved the boring problems.

That's the real pitch for Django. It won't win you a syntax contest. What it does is make a thousand small decisions for you — and most of them are good decisions.

The project/app split

The first thing that confuses people is the difference between a project and an app. You run django-admin startproject once per site. You run python manage.py startapp many times — once per feature area.

A project is the whole website: its settings, its URL routing, its database configuration. An app is a self-contained slice of functionality. A single project can host five apps. A single app can be copied between projects.

Concretely: we run a student portfolio site with two apps. One handles public pages — the about page, the project list, the contact form. The other handles the private grading interface, where instructors upload scores. They share one database and one login system, but their models, views, and templates live in separate folders.

Why split at all? Because the two apps change at different speeds. We touch the portfolio app once a month. The grading app changes every time we adjust an assignment. Keeping them separate means a change to grading never risks breaking the public site. Each app has its own models.py, views.py, urls.py, and migrations/ folder. Django only cares that the app is listed in INSTALLED_APPS in the project's settings.

The request cycle: URLs, views, templates

When a browser asks for /projects/, Django walks a short chain. First, it matches the URL against patterns in urls.py — usually patterns that the project file forwards to the app's urls.py. Then it calls the matching view function. The view does whatever work is needed — querying the database, processing a form — and returns an HttpResponse.

The template is the last step, not the first. Beginners often write templates before anything else, then wonder why their variables are empty. The order is URL → view → template. The view collects the data; the template renders it.

Here's the shortest complete example we show on day one:

# app/urls.py
from django.urls import path
from . import views

urlpatterns = [
    path("projects/", views.project_list, name="project_list"),
]

# app/views.py
from django.shortcuts import render
from .models import Project

def project_list(request):
    projects = Project.objects.all()
    return render(request, "projects/list.html", {"projects": projects})

The template would be a simple for loop over projects. That's the whole cycle. No JavaScript, no server configuration, no hand-built database connection. Three files do the job.

One thing trips up people in week two: the URL name. The string "project_list" in the name=... argument isn't decoration. It's how you link to this page in templates. If you type /projects/ directly into a template, you'll break every link the day that path changes. Use the {% url 'project_list' %} tag instead. It's a habit worth forming before you need it.

Models and the ORM

Django's object-relational mapper is the part students appreciate most, usually around week three, after they've fought with raw SQL in another class.

You define a model as a Python class. Each attribute becomes a database column. Django converts your Python to SQL and back again without a single hand-written SELECT:

# app/models.py
from django.db import models

class Project(models.Model):
    title = models.CharField(max_length=200)
    description = models.TextField()
    created_at = models.DateTimeField(auto_now_add=True)
    published = models.BooleanField(default=False)

That's a full database table in four lines. CharField becomes a VARCHAR(200). TextField becomes TEXT. DateTimeField becomes a timestamp column, and auto_now_add=True fills it once, at creation.

The ORM's real value shows up in queries. Project.objects.filter(published=True).order_by("-created_at") returns the published projects, newest first. In raw SQL that's a five-line statement with a WHERE and an ORDER BY. Here it's readable, testable, and nearly impossible to write incorrectly.

The trade-off, stated honestly: the ORM abstracts the database enough that you can't write every query fluently. We tell students that the day they need a JOIN across three tables with a subquery, they should learn raw SQL in parallel. Django's ORM has a raw() method for exactly that. But for 90% of a typical web app — blogs, portfolios, storefronts, dashboards — the ORM is enough, and it protects you from SQL injection by default because it parameterizes every query it builds.

Migrations and the admin

Two features you didn't know you needed until you need them.

Migrations are Django's way of tracking database changes as code. When you add a field to a model, you run python manage.py makemigrations and then python manage.py migrate. Django generates a migration file describing the change, then applies it. The file goes into version control, so every developer and every server gets the same schema history.

The mistake we see in almost every batch is editing the model and forgetting makemigrations. Then the code crashes with a cryptic error about a missing column. The fix is always the same: run both commands. It's the most common support ticket we answer, and it's easy to avoid once you know the pattern.

The admin panel is what converts people. After you register your model in app/admin.py:

from django.contrib import admin
from .models import Project

admin.site.register(Project)

you get a browser-based interface at /admin/ where you can create, edit, and delete records. No front-end work. No extra logic. Just a working CRUD screen that respects your field types and validation. For internal tools — a content editor updating blog posts, an instructor entering grades — this replaces building an entire feature.

The admin is not the most beautiful interface ever designed, and it's not meant for your public users. It's for your staff. For a training institute, the admin is where we spend most of our working hours: entering student data, checking submissions, fixing a typo in a description. We've never rebuilt that portion by hand. Customizing the admin deeply requires reading a non-trivial amount of documentation, but the default setup covers a shocking amount of what an internal tool needs.

Common questions

Can I use Django for a single-page application or a mobile app backend?

You can, through Django REST Framework, a separate package that turns your models into JSON endpoints. It's not the lightest way to stand up an API — Flask or FastAPI are slimmer — but it's a solid choice if you want one framework for both the web front-end and the API.

How much Python do I need before learning Django?

Be comfortable with functions, classes, and list comprehensions. Django assumes you understand Python syntax but doesn't require expertise. You'll learn the framework's patterns as you go, and those patterns tend to teach better Python habits — like writing small, single-purpose functions — faster than a generic Python course.

Is Django too heavy for a small project?

That depends on what "small" means. For a landing page with no database, yes — Django is overkill, and plain HTML or Flask is better. But for anything

Come and sit a class before you decide

Reading about it only gets you so far. Pick a day, sit in on a class that is already running, write some code, and talk to the students in it. Free, and nothing to pay afterwards unless you want to join.

Djangoweb developmentPython

Found this useful?

Share it with someone who is learning.

CallWhatsAppFree demo