Flask Routes

Started studying Flask with kendra-button project

Docsarrow-up-right

Route

  • Receives URL patterns and executes registered Python methods when requests come in for URLs matching those patterns

    • Finding handler methods to process through URLs like this is called URL Routing!

    • To generate corresponding URLs in handlers, use the url_for method

flask route example

  • Flask routes are connected to Python functions

  • Use the @app.route() decorator to connect URLs and functions

    ex)

    @app.route('/hello')
    def hello_world():
       return "hello world!!!!"

flask route params

  • You can create routes with parameters

  • You can pass string and number types as parameters

    ex)

    string parameter

    number parameter

flask route multiple arguments

  • You can also create flask routes with multiple parameters

    ex)

Last updated