5-Routing in Flask
·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__": app.run(debug=True)
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__": app.run(debug=True)
Run the application using:
* If you like the content, please SUBSCRIBE to my channel for the future content