0Pricing
Flask Academy · Lesson

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

  1. The @app.route Decorator
  2. How a Request Becomes a Response
  3. Return Strings, HTML, and Status Codes
  4. Multiple Routes in One App
← Back to Flask Academy