baseimage-tutorial-framework/src/event_handlers/terminado_server/server.py

24 lines
674 B
Python
Raw Normal View History

import logging
from tornado.ioloop import IOLoop
from tornado.web import Application
from terminado import TermSocket, SingleTermManager
from config import TERMINADO_PORT
class CORSTermSocket(TermSocket):
def check_origin(self, origin):
return True
if __name__ == '__main__':
application = Application(
[(
r'/terminal',
CORSTermSocket,
{'term_manager': SingleTermManager(shell_command=['bash'])}
)]
)
application.listen(TERMINADO_PORT)
logging.getLogger().setLevel(logging.DEBUG)
logging.info('Terminado Mini Server listening on {}'.format(TERMINADO_PORT))
IOLoop.instance().start()