脚本启动flask程序

from flask import Flask
from flask_script import Manage

app = Flask(__name__)
manage = Manage(app)#创建Manage的管理类对象

@app.route("/index")
def index():
    return "ok"


if __name__ = "main":
#通过管理对象来启动程序
    manage.run()



#终端启动 python xxx.py runserver -h 0.0.0.0 -p 8000 #xxx.py指当前文件名

猜你喜欢

转载自www.cnblogs.com/lxx7/p/10358101.html