Show More
@@ -1,20 +1,27 b'' | |||
|
1 | 1 | import os |
|
2 | ||
|
3 | import terminado | |
|
4 | from IPython.utils.version import check_version | |
|
5 | ||
|
6 | if not check_version(terminado.__version__, '0.3.3'): | |
|
7 | raise ImportError("terminado >= 0.3.3 required, found %s" % terminado.__version__) | |
|
8 | ||
|
2 | 9 | from terminado import NamedTermManager |
|
3 | 10 | from tornado.log import app_log |
|
4 | 11 | from IPython.html.utils import url_path_join as ujoin |
|
5 | 12 | from .handlers import TerminalHandler, TermSocket |
|
6 | 13 | from . import api_handlers |
|
7 | 14 | |
|
8 | 15 | def initialize(webapp): |
|
9 | 16 | shell = os.environ.get('SHELL', 'sh') |
|
10 | 17 | terminal_manager = webapp.settings['terminal_manager'] = NamedTermManager(shell_command=[shell]) |
|
11 | 18 | terminal_manager.log = app_log |
|
12 | 19 | base_url = webapp.settings['base_url'] |
|
13 | 20 | handlers = [ |
|
14 | 21 | (ujoin(base_url, r"/terminals/(\w+)"), TerminalHandler), |
|
15 | 22 | (ujoin(base_url, r"/terminals/websocket/(\w+)"), TermSocket, |
|
16 | 23 | {'term_manager': terminal_manager}), |
|
17 | 24 | (ujoin(base_url, r"/api/terminals"), api_handlers.TerminalRootHandler), |
|
18 | 25 | (ujoin(base_url, r"/api/terminals/(\w+)"), api_handlers.TerminalHandler), |
|
19 | 26 | ] |
|
20 | 27 | webapp.add_handlers(".*$", handlers) No newline at end of file |
General Comments 0
You need to be logged in to leave comments.
Login now