我们从Python开源项目中,提取了以下6个代码示例,用于说明如何使用flask_script.Command()。
def refresh_releases(): """Command for updating all release information.""" matl.refresh_releases()
def get_options(self): """Command line options.""" return ( Option('-f', '--fix-imports', action='store_true', dest='fix_imports', default=False, help='Fix imports using isort, before linting'), )
def run(port=5000, host='127.0.0.1'): """Command for creating an eventlet instance.""" socketio.run(app, host=host, port=int(port), use_reloader=True)
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