-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path_exec_server.py
More file actions
34 lines (24 loc) · 821 Bytes
/
_exec_server.py
File metadata and controls
34 lines (24 loc) · 821 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
# ----------------------------------------------------------------------
# _exec_server.py
# Manages Flask server execution with a given port. To alter the host
# address, change TS_HOST in config.py.
#
# Example: python _exec_server.py 12345
# ----------------------------------------------------------------------
from sys import path
path.append("src") # noqa
from sys import argv, exit, stderr
from app import app
from config import PROD, TS_HOST
def main(argv):
if len(argv) != 2:
print("Incorrect number of arguments - specify port only", file=stderr)
exit(1)
try:
port = int(argv[1])
except Exception:
print("Port must be an integer", file=stderr)
exit(1)
app.run(host=TS_HOST, port=port, debug=not PROD)
if __name__ == "__main__":
main(argv)