from flask import Flask app = Flask(__name__) @app.route("/") def hello(): return "Hello World!" app.run(debug=True) # This code is written by Koustav Chakraborty
Here is what the above code is Doing:
1. We’re creating a Flask object called app.
2. We’re using the @app.route decorator to tell Flask what URL should trigger our function.
3. The function is given a name which is also used to generate URLs for that particular function, and returns the message we want to display in the user’s browser.
4. Finally, we have to tell Flask to run the application.