Flask/Hello World
< Flask
This lesson shows how to display Hello world using Flask.
Readings
Multimedia
Activities
- Create or modify the Flask application page.
- On Repl.it, modify
main.pyto include the following code. On your own system, create a new file namedapp.pywith the following code.import flaskapp = flask.Flask(__name__)@app.route('/')def root():return "Hello world!"if __name__ == "__main__":app.run(host='0.0.0.0', port=5000)
- On Repl.it, modify
- Run the program. On your own system use the following command in a terminal window in the same folder as your
app.pyfile:flask run - Refresh the output window or open a browser window to http://localhost:5000.
- Stop the program.