What is flask?
Flask is one of the lightweight framework of python, which is based on web application,(i.e) can build web applications using python with flask application.
- Create a folder of your choice
- Create file name app.py
- Insert the below code
from flask import Flask // importing Flask class from flask
app = Flask(__name__) //
@app.route('/') //decorator tells Flask what URL should trigger our function.
def hello_world():
return 'Hello, World!'
if __name__ == "__main__":
app.run(debug=True) // starts flask dev. server with debug mode to log errors.
- open the root folder of app.py eg: flask_app/
- run this on terminal
pip install flask
python app.py
- open browser, navigate to http://127.0.0.1:5000/ , you will see output Hello, World! [due to technical difficulties could not able to attach the screenshot]
Top comments (0)