Flask添加新命令

 

代码:

import click
from flask import Flask

app = Flask(__name__)

@app.cli.command()
def hg():
    click.echo('lalalal')

运行:

>>>flask hg
lalalal

参考文档:

https://dormousehole.readthedocs.io/en/stable/cli.html#virturalenv

 

posted @ 2018-12-12 14:31  WESWES  阅读(421)  评论(0编辑  收藏  举报