DEV Community

Cover image for Python & OpenAI beginner journey 3 | Flask “Hello World”
Gregor Schafroth
Gregor Schafroth

Posted on

Python & OpenAI beginner journey 3 | Flask “Hello World”

To run my Python OpenAI App in a browser I am going with **Flask**, which is apparently simpler than Django and other similar frameworks.

Below I documented how to get to an easy ‘hello world’, which is the starting point for everything else I do with Flask after that.

1. Install Flask

Terminal: pip install Flask

2. *Create the Flask App*

Create a new Python file app.py and write the following code:

from flask import Flask

app = Flask(__name__)

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

if __name__ == '__main__':
    app.run(debug=True)
Enter fullscreen mode Exit fullscreen mode

3. Run the Flask App

Terminal: python app.py

Top comments (0)