blob: 6e9a596e872e60c8e67ab022cc0d388e95777666 (
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
33
34
|
#!/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()
|