-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
38 lines (26 loc) · 896 Bytes
/
main.py
File metadata and controls
38 lines (26 loc) · 896 Bytes
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 os
import tornado.httpserver
import tornado.web
from tornado.ioloop import IOLoop
from config.environments import Environment
from config.logging_config import setup_logging
from routes import route_map
from utils.database import init_master_pool
setup_logging()
def make_app():
return tornado.web.Application(
route_map.routes,
template_path=os.path.abspath("dist"),
cookie_secret=Environment.COOKIE_SECRET,
websocket_ping_interval=25,
websocket_ping_timeout=25,
debug=Environment.DEBUG,
)
async def async_init():
await init_master_pool()
if __name__ == "__main__":
IOLoop.current().run_sync(async_init)
app = tornado.httpserver.HTTPServer(make_app(), xheaders=True)
app.listen(Environment.PORT, address="0.0.0.0")
print(f"Backend running on port {Environment.PORT}...")
IOLoop.current().start()