2019-03-01 20:16:04 +02:00
|
|
|
import tornado.web
|
|
|
|
|
import tornado.websocket
|
|
|
|
|
import os
|
2019-03-09 23:49:50 +02:00
|
|
|
from .handlers.MainHandler import MainHandler
|
|
|
|
|
from .handlers.SocketHandler import ChameleonWebSocket
|
2019-03-01 20:16:04 +02:00
|
|
|
from tornado.options import define
|
|
|
|
|
|
|
|
|
|
define("port", default=8888, help="run on the given port", type=int)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ChameleonApplication(tornado.web.Application):
|
|
|
|
|
def __init__(self):
|
2019-03-23 23:42:24 +02:00
|
|
|
handlers = [
|
2019-08-13 12:31:26 -07:00
|
|
|
(r"/", MainHandler),
|
|
|
|
|
(r"/websocket", ChameleonWebSocket),
|
|
|
|
|
(r"/(.*)", tornado.web.StaticFileHandler,
|
2019-08-13 13:07:18 -07:00
|
|
|
{"path": r"{0}".format(os.path.join(os.path.dirname(__file__), "site"))}),
|
2019-08-13 12:31:26 -07:00
|
|
|
]
|
2019-03-02 00:12:41 +02:00
|
|
|
|
2019-08-13 12:31:26 -07:00
|
|
|
settings = dict({
|
2019-08-13 13:07:18 -07:00
|
|
|
"template_path": os.path.join(os.path.dirname(__file__), "site"),
|
|
|
|
|
"static_path": os.path.join(os.path.dirname(__file__), "site"),
|
2019-08-13 12:31:26 -07:00
|
|
|
"debug": True
|
|
|
|
|
}
|
2019-03-01 20:16:04 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
super(ChameleonApplication, self).__init__(handlers, **settings)
|