Python flask_script.Manager() Examples

The following are 2 code examples of flask_script.Manager(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module flask_script , or try the search function .
Example #1
Source File: tsctl.py    From timesketch with Apache License 2.0 6 votes vote down vote up
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() 
Example #2
Source File: gitlab_tools.py    From gitlab-tools with GNU General Public License v3.0 5 votes vote down vote up
def migrations() -> None:
    app = create_app(parse_options())
    manager = Manager(app)
    manager.add_command('migrations', MigrateCommand)
    manager.run()