Flask Blueprint CLI commands
Flask Tip - Custom CLI Commands
Custom CLI commands in Flask can be added to specific blueprints, not just to the Flask application.
👇
import click from flask import Blueprint users_blueprint = Blueprint('users', __name__) @users_blueprint.cli.command('init_db') @click.argument('email') def create(email): """Create a new user.""" ... click.echo(f'Added new user (email: {email}!') # in terminal $ flask users --help Commands: create Create a new user.