How to setup simple flask application

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]

Mar 29, 2025 - 13:47
 0
How to setup simple flask application

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.

  1. Create a folder of your choice
  2. Create file name app.py
  3. 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.
  1. open the root folder of app.py eg: flask_app/
  2. run this on terminal
pip install flask
python app.py
  1. 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]