Flask is a lightweight Python framework for creating web applications. It lets a Python program run locally, respond to browser URLs, and grow into a practical project such as a coffee-shop menu. section 10.1 section 10.0
A first Flask application connects a few friendly pieces:
- Run the starter application in Mu’s Web mode and open the local address http://127.0.0.1:5000/ in a browser. section 10.0
- Map a URL to a Python function with a route, such as /hello/<name> or /order. section 10.0
- Receive submitted HTML-form data through request.form, then render a template containing the result. section 10.0
A coffee-shop order
An HTML form offers Coffee and Decaf. Its action targets /order with the POST method. Flask checks the request method, reads the selected drink, and renders a thank-you page showing the order and a New order button. section 10.0
Listing 10.4 The function to process an order
@app.route('/order', methods=('GET', 'POST')) #1
def order():
if request.method == 'POST': #2
drink = request.form['drink'] #3
print("Drink: ", drink) #4
return render_template("forms.html") #5
Browse the order-processing function to see routing, POST detection, form access, and template rendering together. section 10.0



