liveBook · Manning

Django

As explained in Django in Action

Django is an open-source Python web framework for building web applications and managing web content.

Django is a Python web framework for building web applications that run on a web server. It turns a browser visit into Python code: Django matches a URL to a view, and the view returns a response. This lets people use an application through a browser without installing its Python requirements locally. section 1.0 section 1.1

Figure 1.1 Django handling a page visit
figure

A page visit moves from browser to web server, through WSGI to Django, then from URL mapping to a view and back as a response. section 1.1

Django is a framework rather than a library: it controls the overall execution flow and calls application code at the appropriate point. A site is organized as a Django project, with application code placed in apps. section 2.1 section 2.9

Its core mental model has three connected parts:

Django is especially suited to dynamic, multipage sites: content changes when a page is visited, often by querying stored objects and rendering a template. Its built-in tools also support authentication, authorization, and database administration for multiuser applications. section 1.1.1 section 1.1.4 section 1.2

Starting a site and its first page

Create a project with django-admin startproject, then create an app with python manage.py startapp and add it to INSTALLED_APPS. Define a view in views.py that accepts a request and returns an HttpResponse, then register it with path() in urls.py. The framework receives the URL and invokes that view. section 2.9

A practical application can grow from public pages into a multiuser service with logins, password management, user input, uploads, database-backed content, and admin pages. Django can also serve as a backend for single-page applications, mobile applications, or machine-to-machine communication; HTMX can add interactive page updates with little extra JavaScript. section 1.2.4 section 1.2.2 section 12.0

How Django in Action covers it

How deep it goes
Explains request flow, project structure, URL registration, views, ORM, templates, and built-in multiuser tools through implementation steps.
Examples
Uses the RiffMates musicians-seeking-musicians site to add pages, database content, administration, accounts, uploads, and extensions.
What it assumes
Assumes some Python experience while introducing HTTP-adjacent request flow, projects, apps, views, and database interaction from the ground up.
What you can do after
Build it from scratch as a project with apps, URL mappings, views, responses, templates, and database-backed pages.
How it connects
Connects URL routing, views, WSGI, templates, ORM, MVC, authentication, authorization, and Django Admin.

Also explained in

Compare how 2 books explain Django →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Django in Action. The section links point to the parts of the book it draws on.