-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdispatcher.py
More file actions
42 lines (32 loc) · 946 Bytes
/
dispatcher.py
File metadata and controls
42 lines (32 loc) · 946 Bytes
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
35
36
37
38
39
40
41
42
import argparse
from manhattan.dispatch import Dispatcher
from werkzeug.serving import run_simple
import manage_app
def create_dispatcher(env):
# Create and run the application
return Dispatcher(
manage_app.create_app(env)
)
if __name__ == "__main__":
# Parse the command-line arguments
parser = argparse.ArgumentParser(description='Application dispatcher')
parser.add_argument(
'-p',
'--port',
action='store',
default=5001,
dest='port',
required=False,
type=int
)
args = parser.parse_args()
# Initialize the dispatcher app
dispatcher = create_dispatcher('local')
# Run the dispatcher using `run_simple` if initialized for local development
run_simple(
'localhost',
args.port,
dispatcher,
use_debugger=dispatcher.app.config['DEBUG'],
use_reloader=dispatcher.app.config['DEBUG']
)