← Code

Web apps with Flask

Your own HTML pages with Python behind them: routes, pages built from data, forms, saving to a file and JSON, ending with the same API in FastAPI.

Start1. A page from Python

Pages from Python

Routes join addresses to functions; templates build pages from data.

1A page from PythonNot started
2Pages from dataNot started

Forms and saving

Take answers from a form, check them, and save them to a file so they last.

3Join the clubNot started

Make the club page's sign-up form work: the form sends its answers, a route reads them, adds the new member and goes back home.

  1. Predict
  2. Run
  3. Investigate › Back home
  4. Investigate › A choice from a list
  5. Investigate › Spot the bug
  6. Modify › No blank names
  7. Modify › Year level
  8. Record a win
  9. Where this leads
Start lesson
4Keep the sign-upsNot started

APIs

Send data as JSON for other programs, then the same API in FastAPI.

5An API for the clubNot started

Send the club's data as JSON, so other programs (an app, a game, another website) can read it: routes that return data instead of pages.

  1. Predict
  2. Run
  3. Investigate › Data for programs
  4. Investigate › An empty answer
  5. Investigate › Spot the bug
  6. Modify › Stats
  7. Modify › Search
  8. A results API
  9. Where this leads
Start lesson
6The same API in FastAPI OptionalNot started

Progress is saved in this browser only. Nothing is sent anywhere.

For teachers: Teacher guide (notes, answers, solutions, slides and worksheets)