Skip to content

Instantly share code, notes, and snippets.

@uniphil
Created July 31, 2019 15:13
Show Gist options
  • Save uniphil/de8e6253ac8702cf692ff71971f21d15 to your computer and use it in GitHub Desktop.
Save uniphil/de8e6253ac8702cf692ff71971f21d15 to your computer and use it in GitHub Desktop.

making commands wooo

app.cli.add_command(db.cli)
from flask.cli import AppGroup
from .db import db
cli = AppGroup('db', help='Manage the local SQL database')
@cli.command('create', help='Create or update all tables defined by models')
def create_db():
db.create_all()
print('Created {} database at {}'.format(db.engine.name, db.engine.url))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment