from flask_script import Manager
from learn_flask_script import app
manager = Manager(app)
@manager.command
def hello():
print("hello world")
在终端中使用python manage.py hello
即可运行该脚本
from flask_script import Manager
from learn_flask_script import app
manager = Manager(app)
@manager.option('-m','--msg',dest='msg_val',default='world')
def hello_world(msg_val):
print('hello '+msg_val)
在终端中使用python manage.py hello -m csdn
或者python manage.py hello --msg_val=csdn
即可运行该脚本
运行结果为hello csdn