Complete the code to import the Flask class.
from flask import [1]
The Flask class is imported from the flask module to create the app.
Complete the code to get form data from a POST request.
from flask import request name = request.form.get('[1]')
The form field named 'name' is accessed using request.form.get('name').
Fix the error in the route decorator to accept POST requests.
@app.route('/submit', methods=[[1]])
The POST method is required to handle form submissions securely.
Fill both blanks to check if the request method is POST and get form data.
if request.method == [1]: email = request.form.get([2])
Check if the method is 'POST' and then get the 'email' field from the form.
Fill all three blanks to create a route that handles POST, gets username, and redirects.
@app.route('/login', methods=[[1]]) def login(): if request.method == 'POST': user = request.form.get([2]) return [3]('/dashboard')
The route accepts POST requests, gets the 'username' from the form, and redirects to '/dashboard'.
