-
Notifications
You must be signed in to change notification settings - Fork 1
/
start_engine.py
42 lines (31 loc) · 1.46 KB
/
start_engine.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
39
40
41
42
from argh import dispatch_commands
from argh.decorators import named, arg
import imp
import subprocess
from geobricks_rest_engine.config.common_settings import settings as common_settings
from geobricks_rest_engine.config.rest_settings import settings as rest_settings
from geobricks_rest_engine.core.utils import dict_merge
from geobricks_rest_engine.rest import engine as rest_engine
@named('corr')
@arg('--common_settings', help='Common Settings file')
@arg('--rest_settings',help='Rest Settings file')
@arg('--bins',help='Bins')
def start_engine(**kwargs):
settings_app = imp.load_source('geobricks_common_settings', kwargs['common_settings'])
settings_rest_modules = imp.load_source('geobricks_rest_settings', kwargs['rest_settings'])
# loading settings
common_settings["settings"] = dict_merge(common_settings, settings_app.settings_app)
common_settings["settings"] = common_settings["settings"]["settings"]
# loading modules
rest_settings["settings"] = dict_merge(rest_settings, settings_rest_modules.settings_rest_modules)
rest_settings["settings"] = rest_settings["settings"]["settings"]
# run engine
#rest_engine.run_engine(False)
# run uwsgi
#from geobricks_rest_engine.rest.engine import app
#subprocess.call(["env/bin/uwsgi", "--socket", "127.0.0.1:21000", "-w", app])
# env/bin/uwsgi --socket 127.0.0.1:21000 -w WSGI:app -p 2
def main():
dispatch_commands([start_engine])
if __name__ == '__main__':
main()