本文整理匯總了Python中flask_migrate.MigrateCommand方法的典型用法代碼示例。如果您正苦於以下問題:Python flask_migrate.MigrateCommand方法的具體用法?Python flask_migrate.MigrateCommand怎麽用?Python flask_migrate.MigrateCommand使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類flask_migrate
的用法示例。
在下文中一共展示了flask_migrate.MigrateCommand方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: main
# 需要導入模塊: import flask_migrate [as 別名]
# 或者: from flask_migrate import MigrateCommand [as 別名]
def main():
# Setup Flask-script command manager and register commands.
shell_manager = Manager(create_app)
shell_manager.add_command('add_user', AddUser())
shell_manager.add_command('list_users', ListUsers())
shell_manager.add_command('add_group', AddGroup())
shell_manager.add_command('list_groups', ListGroups)
shell_manager.add_command('manage_group', GroupManager())
shell_manager.add_command('add_index', AddSearchIndex())
shell_manager.add_command('db', MigrateCommand)
shell_manager.add_command('drop_db', DropDataBaseTables())
shell_manager.add_command('list_sketches', ListSketches())
shell_manager.add_command('purge', PurgeTimeline())
shell_manager.add_command('search_template', SearchTemplateManager())
shell_manager.add_command('import', ImportTimeline())
shell_manager.add_command('version', GetVersion())
shell_manager.add_command('runserver',
Server(host='127.0.0.1', port=5000))
shell_manager.add_option(
'-c',
'--config',
dest='config',
default='/etc/timesketch/timesketch.conf',
required=False)
shell_manager.run()
示例2: migrations
# 需要導入模塊: import flask_migrate [as 別名]
# 或者: from flask_migrate import MigrateCommand [as 別名]
def migrations() -> None:
app = create_app(parse_options())
manager = Manager(app)
manager.add_command('migrations', MigrateCommand)
manager.run()
示例3: create_app
# 需要導入模塊: import flask_migrate [as 別名]
# 或者: from flask_migrate import MigrateCommand [as 別名]
def create_app(script_info=None):
"""Initialise the app object"""
if os.environ.get("DRIBDAT_ENV") == 'prod':
app = init_app(ProdConfig)
else:
app = init_app(DevConfig)
app.shell_context_processor(shell_context)
app.cli.add_command('db', MigrateCommand)
return app