Multiple Routes in One App
Add several pages and avoid route collisions.
Many Pages, One App
A real site has many pages. You add each one with its own route and view function, all living inside the same app file.
Stack the Decorators
Just write more @app.route blocks. Each pairs a unique path with its own function, and Flask keeps track of every one.
@app.route("/home")
def home():
return "Home"All lessons in this course
- The @app.route Decorator
- How a Request Becomes a Response
- Return Strings, HTML, and Status Codes
- Multiple Routes in One App