Unit content
Django
Django is a Python web framework that organizes server-side applications around URL routing, views, templates, models and other reusable components.
Request routing
A Django URL configuration maps request paths to Python view code. The view receives a request object, performs application logic and returns an HTTP response.
Conceptually:
URL → view → response
Templates
A view can render an HTML template with context data supplied by Python:
return render(request, "article.html", {"article": article})
Templates keep document markup separate from much of the server-side control logic.
Models and ORM
Django models describe persistent application entities as Python classes. The object-relational mapper (ORM) translates many operations on those objects into relational database operations.
Using an ORM does not remove the relational model: tables, keys, constraints and transactions still exist beneath the Python interface.
Migrations
Schema changes are represented through migrations that describe how the database structure evolves over time. Applying migrations keeps persistent schema changes explicit and reproducible.
Forms and validation
Django provides form and model validation tools for parsing submitted data and reporting errors, while authentication and authorization remain explicit application responsibilities.
Django assembles familiar web and database concepts into one Python framework; understanding those underlying concepts makes the framework's abstractions easier to reason about.