On Day 7, we connected the two worlds: the HTML/CSS web design we built yesterday and the Python logic we learned last week. The glue that connects them is Flask—a lightweight Python web framework.
1. Flask Routing Basics
Flask is refreshingly simple. You import Flask, create an app instance, and define routes using decorators like @app.route('/'). Whenever someone visits that URL in their browser, Flask runs that specific Python function and returns the web page.
2. Templates and Web Forms
To serve our actual webpage, we used render_template('index.html'). When the user types into an input box and hits Submit, the form sends an HTTP POST request to Flask. Flask grabs the text using request.form.get('message'), processes it, and sends the answer back to the frontend using Jinja tags like {{ message }}.
3. The 120-Line Reality Check
An interesting moment happened when Rashmi introduced Hugging Face accounts for using open-source models. Most of the class struggled just to sign up, while I had already been using my account since 2024. Then, when the cohort felt overwhelmed by a 120-line Flask file, I had a quiet moment of reflection: on my personal projects, I've managed codebases with thousands of lines of code. It wasn't about feeling superior—it was just realizing how differently you see programming once you build real projects on your own time.