Flask: your first web app
18-minute lesson · module-webapps-03
You are previewing this course as a guest
Read anything and run any exercise you like. It all runs in your own browser, so nothing here is saved: no XP, no progress, and the AI tutor needs an account. Sign in and your work starts counting.
Flask: your first web app
18-minute lesson · module-webapps-03
- Create a Flask application object and run the development server.
- Map a URL path to a Python function with the @app.route decorator.
- Return HTML from a view function and view it in a browser.
- Explain why a Flask app must be run locally rather than in the browser sandbox.
Source attribution
Status: adapted
How to Think Like a Computer Scientist: Interactive Edition — source · Web Applications / Writing Web Applications With Flask / More About Flask
Adaptation notes. Read-along lesson. Flask binds a network port and runs a long-lived server process, which the in-browser Pyodide sandbox cannot do, so there is no graded coding step. All code is for reading and for running on the student's own machine. The hello/greeting examples are ours.
License notes. Original chapter is GNU FDL 1.3 (Brad Miller, David Ranum, and the upstream Elkner/Downey/Meyers text). No verbatim text reproduced. Flask is BSD-licensed; only API names are referenced.