Flask Getting started with Flask Hello World

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Example

Create hello.py:

from flask import Flask

app = Flask(__name__)


@app.route('/')
def hello():
    return 'Hello, World!'

Then run it with:

export FLASK_APP=hello.py
flask run
 * Running on http://localhost:5000/

Adding the code below will allow running it directly with python hello.py.

if __name__ == '__main__':
    app.run()


Got any Flask Question?