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:
@app.route('/')
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:
@app.route('/hello')
def hello():
return 'Hello, Welcome to blog SmartRS!'
if __name__ == "__main__":
app.run(debug=True)
Run the application using:
python "filename".py
* If you like the content, please SUBSCRIBE to my channel for the future content
Top comments (0)