diff --git a/jupyter_server/base/handlers.py b/jupyter_server/base/handlers.py index 75e23f606b..e58234b8ea 100755 --- a/jupyter_server/base/handlers.py +++ b/jupyter_server/base/handlers.py @@ -34,7 +34,7 @@ from jupyter_server.utils import ensure_async, url_path_join, url_is_absolute, url_escape, urldecode_unix_socket_path from jupyter_server.services.security import csp_report_uri -from torndsession.session import SessionMixin +from ..torndsession.session import SessionMixin #----------------------------------------------------------------------------- # Top-level handlers @@ -91,16 +91,16 @@ def set_default_headers(self): self.log.debug(e) def get_session_id(self): - return self.session.id + return self.web_session.id def get_session(self): - return self.session + return self.web_session def get_sessions(self): - return self.session.driver._data_handler + return self.web_session.driver._data_handler def get_sessions_count(self): - return len(self.session.driver._data_handler) + return len(self.web_session.driver._data_handler) def force_clear_cookie(self, name, path="/", domain=None): """Deletes the cookie with the given name. diff --git a/jupyter_server/serverapp.py b/jupyter_server/serverapp.py index 1e1f6ed5c1..a98fce7a2b 100755 --- a/jupyter_server/serverapp.py +++ b/jupyter_server/serverapp.py @@ -298,8 +298,15 @@ def init_settings(self, jupyter_app, kernel_manager, contents_manager, allow_password_change=jupyter_app.allow_password_change, server_root_dir=root_dir, jinja2_env=env, - terminals_available=terminado_available and jupyter_app.terminals_enabled, - serverapp=jupyter_app + terminals_available=False, # Set later if terminals are available + serverapp=jupyter_app, + session_settings = dict( + driver='memory', + driver_settings={'host': self}, + force_persistence=True, + sid_name='torndsessionID', + session_lifetime=1800 + ), ) # allow custom overrides for the tornado web app.