flask manager命令怎么用
你好,問(wèn)一下flask manager命令怎么用?
鴻蒙傳說(shuō)
2019-11-19 18:14:04
TA貢獻(xiàn)2041條經(jīng)驗(yàn) 獲得超4個(gè)贊
from flask import Flask
# 導(dǎo)入flask-script擴(kuò)展
from flask_script import Manager
app = Flask(__name__)
# 實(shí)例化Manage管理器對(duì)象,把 Manager 類和應(yīng)用程序?qū)嵗M(jìn)行關(guān)聯(lián)
manage = Manager(app)
# 寫視圖函數(shù)
@app.route('/')
def index():
return '床前明月光'
if __name__ == '__main__':
manage.run()
# 要是使用Pycharm運(yùn)行,需要再Edit Configuration中Script parameters:添加runserver
舉報(bào)