baseimage-tutorial-framework/app.py

31 lines
920 B
Python
Raw Normal View History

2017-11-17 14:57:03 +00:00
import logging
2017-11-21 09:25:57 +00:00
import sys
2017-11-17 14:57:03 +00:00
import tornado
import zmq
from tornado.web import Application
from tornado.ioloop import IOLoop
from config import WEB_PORT
from handlers import MainHandler, ZMQWebSocketHandler
if __name__ == '__main__':
routes = [
(r'/', MainHandler),
(r'/ws', ZMQWebSocketHandler),
]
application = Application(
routes,
template_path=r'templates/',
static_path=r'static/',
autoreload=True
)
application.listen(WEB_PORT)
logging.getLogger().setLevel(logging.DEBUG)
2017-11-21 09:25:57 +00:00
logging.debug('Python version: {}'.format(sys.version[:5]))
2017-11-17 14:57:03 +00:00
logging.debug('Tornado version: {}'.format(tornado.version))
logging.debug('ZeroMQ version: {}'.format(zmq.zmq_version()))
logging.debug('PyZMQ version: {}'.format(zmq.pyzmq_version()))
logging.info('Tornado application listening on port {}'.format(WEB_PORT))
IOLoop.instance().start()