#!/usr/bin/env python from flask.ext.script import Command, Manager, Server, Shell from accounts import app from accounts.utils.console import TablePrinter class ListServices(Command): """List the configured services.""" def __init__(self, app): self.app = app def run(self): table = TablePrinter(['Name', 'URL']) table.output([(service.name, service.url) for service in self.app.all_services]) def main(): manager = Manager(app) manager.add_command( 'runserver', Server(host='::', use_debugger=False)) manager.add_command( 'debug', Server(host='::', use_debugger=True)) manager.add_command( 'shell', Shell(make_context=lambda: dict(app=app))) manager.add_command( 'list-services', ListServices(app)) manager.run() if __name__ == '__main__': main()