本文整理汇总了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