mirror of https://github.com/huashengdun/webssh
29 lines
672 B
Python
29 lines
672 B
Python
import logging
|
|
import tornado.web
|
|
|
|
from tornado.ioloop import IOLoop
|
|
from tornado.options import parse_command_line, options
|
|
from handler import IndexHandler, WsockHandler
|
|
from settings import get_application_settings
|
|
|
|
|
|
def main():
|
|
parse_command_line()
|
|
settings = get_application_settings()
|
|
|
|
handlers = [
|
|
(r'/', IndexHandler),
|
|
(r'/ws', WsockHandler)
|
|
]
|
|
|
|
loop = IOLoop.current()
|
|
app = tornado.web.Application(handlers, **settings)
|
|
app._loop = loop
|
|
app.listen(options.port, options.address)
|
|
logging.info('Listening on {}:{}'.format(options.address, options.port))
|
|
loop.start()
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main()
|