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):
|
|
|
|
|
handlers = [(r"/", MainHandler),
|
2019-03-08 15:55:36 +02:00
|
|
|
(r"/websocket", ChameleonWebSocket),
|
2019-03-10 01:12:53 +02:00
|
|
|
(r"/css/(.*)", tornado.web.StaticFileHandler, {'path': os.path.join(os.path.dirname(__file__), "../../Site/css")}),
|
|
|
|
|
(r"/js/(.*)", tornado.web.StaticFileHandler, {'path': os.path.join(os.path.dirname(__file__), "../../Site/js")}),
|
|
|
|
|
(r"/templates/(.*)", tornado.web.StaticFileHandler, {'path': os.path.join(os.path.dirname(__file__), "../../Site/templates")}),
|
2019-03-09 23:59:19 +02:00
|
|
|
(r"/(.*)", tornado.web.StaticFileHandler, {'path': os.path.join(os.path.dirname(__file__), "../../Site")}),
|
2019-03-02 21:17:48 +02:00
|
|
|
(r"/assets/(.*)", tornado.web.StaticFileHandler, {'path': os.path.join(os.path.dirname(__file__), "../../Site/assets")})]
|
2019-03-02 00:12:41 +02:00
|
|
|
|
2019-03-01 20:16:04 +02:00
|
|
|
settings = dict(
|
|
|
|
|
template_path=os.path.join(os.path.dirname(__file__), "../../Site")
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
super(ChameleonApplication, self).__init__(handlers, **settings)
|