Created
March 1, 2019 10:06
-
-
Save renzon/83b464979972fa55e06c8734bd23bd1e to your computer and use it in GitHub Desktop.
Flask Cli Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask.cli import AppGroup | |
user_cli = AppGroup('users', help='Manage users') | |
@user_cli.command('create_admin', help='Create a user with Admin role on database') | |
@click.option('--name', prompt='User name') | |
@click.option('--email', prompt='User email') | |
@click.option('--password', prompt='User password', hide_input='True', confirmation_prompt=True) | |
def create_admin(name, email, password): | |
... | |
def init_app(app: Flask, url_prefix=''): | |
# Setup Flask-User | |
app.cli.add_command(user_cli) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment