forked from projecteru/redis-ctl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
38 lines (30 loc) · 859 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
33
34
35
36
37
38
import sys
import config
import models.recover
import models.base
import stats.db
def run_app(app, debug):
import file_ipc
file_ipc.write_nodes_proxies_from_db()
if debug:
app.debug = True
return app.run(port=config.SERVER_PORT)
from app import WrapperApp
WrapperApp(app, {
'bind': '0.0.0.0:%d' % config.SERVER_PORT,
'workers': 2,
'timeout': 86400,
}).run()
def init_app():
config.init_logging()
if config.INFLUXDB and config.INFLUXDB['host']:
stats.db.init(**config.INFLUXDB)
import handlers
app = handlers.base.app
app.config['SQLALCHEMY_DATABASE_URI'] = config.SQLALCHEMY_DATABASE_URI
models.base.init_db(app)
models.recover.recover()
return app, config.DEBUG == 1
if __name__ == '__main__':
app, debug = init_app()
run_app(app, debug)