Overview
Your programs have made decisions, organized records, and saved JSON files. In Part 6, a command interface called the application’s model and storage operations. Here a browser becomes the interface to familiar Python functions and records. You will build a small web application that displays, searches, and saves records.
A browser sends a request to a running Python program, called the server. A route function handles the request and returns a response. A template combines records with a page description to produce HTML that the browser displays.
The diagram below connects that browser interface to the Python operations you already know.
The chapters form three units, each adding a responsibility to the application:
| Unit | Chapters | What you will practise |
|---|---|---|
| Displaying and finding records | 2-6 | Follow a request into a list, detail page, or search result. |
| Receiving input | 7-8 | Connect form values to an addition operation and combine the interface. |
| Building a persistent application | 9-10 | Save records in JSON and build a Reading Journal. |
Finish with the recap and feedback.
Working with the Examples
Set up one web-app folder and its environment in Chapter 2, then reuse it throughout the examples. Chapter 3 replaces main.py with an HTML version. Chapter 4 replaces it with a JSON-backed version and adds templates and supporting files; Chapters 5-7 extend those files. Chapters 8-9 use the resulting application, which handles task records with id, title, and category at /tasks.
The exercises provide starter files in the exercise editor. Some exercises form short chains: complete one to unlock the next, whose starter includes a sample solution to the preceding step. Use each exercise’s supplied files. Choose Show file tree to inspect them, make your changes, and choose Submit for feedback. The editor’s Python Run command is disabled for these web exercises.
For the local examples, predict the response before making a request. Compare your prediction with the page, the returned HTML, and the server terminal.