-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
32 lines (26 loc) · 789 Bytes
/
main.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
import sys
import os
from optparse import OptionParser
from api import *
import pdb
#---------------------------------------------
# launch
# --------------------------------------------
if __name__ == "__main__":
from app import start_app
import config
# decide which environment to set up
parser = OptionParser()
parser.add_option("--test", action="store_true", dest="test_mode")
parser.add_option("--prod", action="store_true", dest="prod_mode")
# ... add other options here
(options,args) = parser.parse_args()
app = None
if options.test_mode:
app = start_app(config.Test)
elif options.prod_mode:
app = start_app(config.Prod)
else:
app = start_app(config.Dev) # default is Dev env
port = int(os.environ.get("PORT", 5000))
app.run(host='0.0.0.0', port=port)