python类Manager()的实例源码

manage.py 文件源码 项目:repocribro 作者: MarekSuchanek 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def run():
    """Run the CLI manager for the web application

    .. todo:: allow extension add options & commands,
              separate create and run part of function
              command for checking config
    """
    manager = flask_script.Manager(create_app)
    manager.add_option('-c', '--config', dest='cfg_files',
                       required=False, action='append',
                       default=['DEFAULT'])
    manager.add_option('-v', '--version', action='version',
                       version='{} v{}'.format(PROG_NAME, VERSION))

    manager.add_command('db', flask_migrate.MigrateCommand)
    manager.add_command('db-create', DbCreateCommand)
    manager.add_command('repocheck', RepocheckCommand)
    manager.add_command('assign-role', AssignRoleCommand)
    manager.add_command('check-config', CheckConfigCommand)

    manager.run()
exts.py 文件源码 项目:apizen 作者: blackmatrix7 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def __call__(self, app=None, **kwargs):
        """
        ???Manager????Options will be ignored.???
        ???flask-script?Manager??app??????????
        ???????
        """
        if app is None:
            app = self.app
            if app is None:
                raise Exception("There is no app here. This is unlikely to work.")

        if isinstance(app, Flask):
            return app

        app = app(**kwargs)
        self.app = app
        return app
__init__.py 文件源码 项目:apizen 作者: blackmatrix7 项目源码 文件源码 阅读 16 收藏 0 点赞 0 评论 0
def __call__(self, app=None, **kwargs):
        """
        ???Manager????Options will be ignored.???
        ???flask-script?Manager??app??????????
        ???????
        """
        if app is None:
            app = self.app
            if app is None:
                raise Exception("There is no app here. This is unlikely to work.")

        if isinstance(app, Flask):
            return app

        app = app(**kwargs)
        self.app = app
        return app
application.py 文件源码 项目:docket 作者: rocknsm 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def manager(self):
        return Manager(self.flask_app)
manage.py 文件源码 项目:fireq 作者: superdesk 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def main():
    import sys
    from flask_script import Manager
    from superdesk import COMMANDS
    from superdesk.ws import create_server

    if len(sys.argv) == 2 and sys.argv[1] == 'ws':
        create_server(application.config)
    else:
        manager = Manager(application)
        manager.run(COMMANDS)
__init__.py 文件源码 项目:flask-pw 作者: klen 项目源码 文件源码 阅读 16 收藏 0 点赞 0 评论 0
def manager(self):
        """Integrate a Flask-Script."""
        from flask_script import Manager, Command

        manager = Manager(usage="Migrate database.")
        manager.add_command('create', Command(self.cmd_create))
        manager.add_command('migrate', Command(self.cmd_migrate))
        manager.add_command('rollback', Command(self.cmd_rollback))
        manager.add_command('list', Command(self.cmd_list))
        manager.add_command('merge', Command(self.cmd_merge))

        return manager
tests.py 文件源码 项目:flask-ci 作者: vicenteneto 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def test_with_default_commands(self):
        manager = Manager(self.app)
        manager.set_defaults()

        assert 'runserver' in manager._commands
        assert 'shell' in manager._commands


问题


面经


文章

微信
公众号

扫码关注公众号