Azad Rasul




5-Routing in Flask

Azad Rasul's photo
Azad Rasul
·Jan 3, 2023·

1 min read

Play this article

Modern web applications apply meaningful URLs to assist users to come back to them easily when they can remember them.

Use the route() decorator to connect a function to a URL.

We can use index route ('/') and then define it:

def index():
    return 'index.html'

if __name__ == "__main__":

Or we can use hello route and then define it to return "Hello, Welcome to blog SmartRS!" directly:

def hello():
    return 'Hello, Welcome to blog SmartRS!'

if __name__ == "__main__":

Run the application using:

python "filename".py

* If you like the content, please SUBSCRIBE to my channel for the future content

Share this