1. 程式人生 > >Flask新增新命令

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