两种运行flask的方法

方法1: 官网例子,flask运行

from flask import Flask

app = Flask(__name__)

@app.route("/")
def hello_world():
    return "

Hello, World!

"

保存成hello.py

$ export FLASK_APP=hello
$ flask run
 * Running on http://127.0.0.1:5000/

方法2: python运行

from flask import Flask

app = Flask(__name__)

@app.route("/")
def hello_world():
    return "

Hello, World!

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

保存成hello.py

$ python hello.py

你可能感兴趣的:(大数据,flask,python,后端)