Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Decorators - Flask

In Flask we use decorators to map pathes to functions and make them “routes”.

from flask import Flask

app = Flask(__name__)

@app.get("/")
def main():
    return "Hello World!"

@app.get("/login")
def login():
    return "Showing the login page ..."
$ flask --app flask_app run