-
Notifications
You must be signed in to change notification settings - Fork 7
/
run.py
38 lines (33 loc) · 1.07 KB
/
run.py
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
import argparse
from floodviz import app as application
from flask_frozen import Freezer
freezer = Freezer(application)
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--host', '-ht', type=str)
parser.add_argument('--port', '-p', type=str)
parser.add_argument('--freeze', '-f', action='store_true', default=False)
parser.add_argument('--norun', '-n', action='store_true', default=False)
args = parser.parse_args()
host_val = args.host
port_val = args.port
do_freeze = args.freeze
run = not args.norun
if host_val is not None:
host = host_val
else:
host = '127.0.0.1'
if port_val is not None:
port = port_val
else:
port = 5050
if do_freeze:
print("freezing")
freezer.freeze()
print("frozen")
if run:
freezer.serve(host=host, port=port, threaded=True)
else:
application.run(host=host, port=port, threaded=True)
# run from the command line as follows
# python run.py -ht <ip address of your choice>