forked from rusenask/mirage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.py
35 lines (29 loc) · 971 Bytes
/
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
from logging.config import fileConfig
import sys
from stubo.scripts import get_default_config
from argparse import ArgumentParser
def main():
"""
Launches application
"""
parser = ArgumentParser(
description="Run Mirage app"
)
parser.add_argument('-c', '--config', dest='config',
help="Path to configuration file (defaults to $CWD/etc/dev.ini)")
args = parser.parse_args()
# looking for configuration path
config_path = args.config
if not config_path:
# if path not provided - looking at default directory - project root
config_path = get_default_config()
try:
fileConfig(config_path)
except Exception, e:
print "Unable to load config file: {0}, error={1}".format(config_path, e)
sys.exit(-1)
from stubo.service.run_stubo import TornadoManager
tm = TornadoManager(config_path)
tm.start_server()
if __name__ == "__main__":
main()