making commands wooo
Created
July 31, 2019 15:13
-
-
Save uniphil/de8e6253ac8702cf692ff71971f21d15 to your computer and use it in GitHub Desktop.
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
app.cli.add_command(db.cli) |
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 | |
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