blob: 18a96bffc5571dc45b5e8995af37fa4954b834b2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
#!/usr/bin/env python
from flask import current_app
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."""
name = 'list-services'
def run(self):
table = TablePrinter(['Name', 'URL'])
table.output([(service.name, service.url)
for service in current_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())
manager.add_command(ListServices)
manager.run()
if __name__ == '__main__':
main()
|