Monday, July 26, 2021

how to implement dynamic routing in Flask

 When we want to pass into a variable on routing. we can use the following code to pass the variable <routeVariable> in the route path.

@app.route("/mypage/<username>"

def  my_page(username):

        return f"<h1>Hello {username}'s page<h1>"


the output is 

hello dan's page

No comments:

Post a Comment