-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.py
executable file
·28 lines (21 loc) · 1.16 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
#!/usr/bin/env python3
from argparse import ArgumentParser
from expense import app
if __name__ == '__main__':
description = "Runs the Flask server for the expense tracking program."
parser = ArgumentParser(description=description)
parser.add_argument("-0", "--public", help="Makes the server world-"
"accessible by hosting at 0.0.0.0.",
action="store_true")
parser.add_argument("-p", "--port", help="Defines the port. Defaults to "
"9999.", type=int, default=9999)
parser.add_argument("-d", "--debug", help="Turns server debug mode on. "
"(Not recommended for world-accesible servers!)",
action="store_true")
parser.add_argument("-r", "--reload", help="Turns the automatic realoder "
"on. This setting restarts the server whenever a "
"change in the source is detected.",
action="store_true")
args = parser.parse_args()
app.run(host="0.0.0.0" if args.public else "localhost", port=args.port,
use_debugger=args.debug, use_reloader=args.reload)