Simple Flask sample
Just wanna to create a very simple Flask application in a single python source file:
simple.py
To run this Flask application, run the following:
Now, navigate "http://localhost:5000" to see the word "Hello World" displayed on the browser.
simple.py
from flask import Flask
application = Flask("simple")
@application.route("/")
def index():
return "Hello World"
To run this Flask application, run the following:
- export FLASK_APP=simple.py
- flask run
- flask run --host 0.0.0.0
Now, navigate "http://localhost:5000" to see the word "Hello World" displayed on the browser.
Comments
Post a Comment