-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_tornado.py
27 lines (22 loc) · 694 Bytes
/
run_tornado.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
#!/usr/bin/python3
import platform
import sys
import asyncio
from tornado.options import define
if sys.platform == 'win32':
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
from tornado.wsgi import WSGIContainer
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop
from app import app
address = '0.0.0.0'
port = 80
http_server = HTTPServer(WSGIContainer(app))
http_server.listen(port, address)
os_string = platform.system()
print('Running on ' + os_string)
output_string = 'Running on http://%s:%s (Press CTRL+C to quit)' % (address, port)
print(output_string)
if os_string != "Windows":
http_server.start(0)
IOLoop.instance().start()