##// END OF EJS Templates
Merge pull request #5100 from minrk/base_kernel_url...
Brian E. Granger -
r15379:517bfbf6 merge
parent child Browse files
Show More
@@ -136,10 +136,6 b' class IPythonHandler(AuthenticatedHandler):'
136 def base_url(self):
136 def base_url(self):
137 return self.settings.get('base_url', '/')
137 return self.settings.get('base_url', '/')
138
138
139 @property
140 def base_kernel_url(self):
141 return self.settings.get('base_kernel_url', '/')
142
143 #---------------------------------------------------------------
139 #---------------------------------------------------------------
144 # Manager objects
140 # Manager objects
145 #---------------------------------------------------------------
141 #---------------------------------------------------------------
@@ -181,7 +177,6 b' class IPythonHandler(AuthenticatedHandler):'
181 def template_namespace(self):
177 def template_namespace(self):
182 return dict(
178 return dict(
183 base_url=self.base_url,
179 base_url=self.base_url,
184 base_kernel_url=self.base_kernel_url,
185 logged_in=self.logged_in,
180 logged_in=self.logged_in,
186 login_available=self.login_available,
181 login_available=self.login_available,
187 static_url=self.static_url,
182 static_url=self.static_url,
@@ -160,7 +160,6 b' class NotebookWebApplication(web.Application):'
160 # basics
160 # basics
161 log_function=log_request,
161 log_function=log_request,
162 base_url=base_url,
162 base_url=base_url,
163 base_kernel_url=ipython_app.base_kernel_url,
164 template_path=template_path,
163 template_path=template_path,
165 static_path=ipython_app.static_file_path,
164 static_path=ipython_app.static_file_path,
166 static_handler_class = FileFindHandler,
165 static_handler_class = FileFindHandler,
@@ -431,18 +430,6 b' class NotebookApp(BaseIPythonApplication):'
431 self.log.warn("base_project_url is deprecated, use base_url")
430 self.log.warn("base_project_url is deprecated, use base_url")
432 self.base_url = new
431 self.base_url = new
433
432
434 base_kernel_url = Unicode('/', config=True,
435 help='''The base URL for the kernel server
436
437 Leading and trailing slashes can be omitted,
438 and will automatically be added.
439 ''')
440 def _base_kernel_url_changed(self, name, old, new):
441 if not new.startswith('/'):
442 self.base_kernel_url = '/'+new
443 elif not new.endswith('/'):
444 self.base_kernel_url = new+'/'
445
446 websocket_url = Unicode("", config=True,
433 websocket_url = Unicode("", config=True,
447 help="""The base URL for the websocket server,
434 help="""The base URL for the websocket server,
448 if it differs from the HTTP server (hint: it almost certainly doesn't).
435 if it differs from the HTTP server (hint: it almost certainly doesn't).
@@ -46,7 +46,7 b' class MainKernelHandler(IPythonHandler):'
46 km = self.kernel_manager
46 km = self.kernel_manager
47 kernel_id = km.start_kernel()
47 kernel_id = km.start_kernel()
48 model = km.kernel_model(kernel_id, self.ws_url)
48 model = km.kernel_model(kernel_id, self.ws_url)
49 location = url_path_join(self.base_kernel_url, 'api', 'kernels', kernel_id)
49 location = url_path_join(self.base_url, 'api', 'kernels', kernel_id)
50 self.set_header('Location', url_escape(location))
50 self.set_header('Location', url_escape(location))
51 self.set_status(201)
51 self.set_status(201)
52 self.finish(jsonapi.dumps(model))
52 self.finish(jsonapi.dumps(model))
@@ -85,7 +85,7 b' class KernelActionHandler(IPythonHandler):'
85 if action == 'restart':
85 if action == 'restart':
86 km.restart_kernel(kernel_id)
86 km.restart_kernel(kernel_id)
87 model = km.kernel_model(kernel_id, self.ws_url)
87 model = km.kernel_model(kernel_id, self.ws_url)
88 self.set_header('Location', '{0}api/kernels/{1}'.format(self.base_kernel_url, kernel_id))
88 self.set_header('Location', '{0}api/kernels/{1}'.format(self.base_url, kernel_id))
89 self.write(jsonapi.dumps(model))
89 self.write(jsonapi.dumps(model))
90 self.finish()
90 self.finish()
91
91
@@ -64,7 +64,7 b' class SessionRootHandler(IPythonHandler):'
64 else:
64 else:
65 kernel_id = km.start_kernel(cwd=nbm.get_os_path(path))
65 kernel_id = km.start_kernel(cwd=nbm.get_os_path(path))
66 model = sm.create_session(name=name, path=path, kernel_id=kernel_id, ws_url=self.ws_url)
66 model = sm.create_session(name=name, path=path, kernel_id=kernel_id, ws_url=self.ws_url)
67 location = url_path_join(self.base_kernel_url, 'api', 'sessions', model['id'])
67 location = url_path_join(self.base_url, 'api', 'sessions', model['id'])
68 self.set_header('Location', url_escape(location))
68 self.set_header('Location', url_escape(location))
69 self.set_status(201)
69 self.set_status(201)
70 self.finish(json.dumps(model, default=date_default))
70 self.finish(json.dumps(model, default=date_default))
@@ -48,7 +48,6 b' function (marked) {'
48
48
49 var opts = {
49 var opts = {
50 base_url : IPython.utils.get_body_data("baseUrl"),
50 base_url : IPython.utils.get_body_data("baseUrl"),
51 base_kernel_url : IPython.utils.get_body_data("baseKernelUrl"),
52 notebook_path : IPython.utils.get_body_data("notebookPath"),
51 notebook_path : IPython.utils.get_body_data("notebookPath"),
53 notebook_name : IPython.utils.get_body_data('notebookName')
52 notebook_name : IPython.utils.get_body_data('notebookName')
54 };
53 };
@@ -21,7 +21,6 b' var IPython = (function (IPython) {'
21 this.name = notebook.notebook_name;
21 this.name = notebook.notebook_name;
22 this.path = notebook.notebook_path;
22 this.path = notebook.notebook_path;
23 this.base_url = notebook.base_url;
23 this.base_url = notebook.base_url;
24 this.base_kernel_url = options.base_kernel_url || utils.get_body_data("baseKernelUrl");
25 };
24 };
26
25
27 Session.prototype.start = function(callback) {
26 Session.prototype.start = function(callback) {
@@ -89,7 +88,7 b' var IPython = (function (IPython) {'
89 */
88 */
90 Session.prototype._handle_start_success = function (data, status, xhr) {
89 Session.prototype._handle_start_success = function (data, status, xhr) {
91 this.id = data.id;
90 this.id = data.id;
92 var kernel_service_url = utils.url_path_join(this.base_kernel_url, "api/kernels");
91 var kernel_service_url = utils.url_path_join(this.base_url, "api/kernels");
93 this.kernel = new IPython.Kernel(kernel_service_url);
92 this.kernel = new IPython.Kernel(kernel_service_url);
94 this.kernel._kernel_started(data.kernel);
93 this.kernel._kernel_started(data.kernel);
95 };
94 };
@@ -23,7 +23,6 b' window.mathjax_url = "{{mathjax_url}}";'
23
23
24 data-project="{{project}}"
24 data-project="{{project}}"
25 data-base-url="{{base_url}}"
25 data-base-url="{{base_url}}"
26 data-base-kernel-url="{{base_kernel_url}}"
27 data-notebook-name="{{notebook_name}}"
26 data-notebook-name="{{notebook_name}}"
28 data-notebook-path="{{notebook_path}}"
27 data-notebook-path="{{notebook_path}}"
29 class="notebook_app"
28 class="notebook_app"
@@ -13,7 +13,6 b''
13 data-project="{{project}}"
13 data-project="{{project}}"
14 data-base-url="{{base_url}}"
14 data-base-url="{{base_url}}"
15 data-notebook-path="{{notebook_path}}"
15 data-notebook-path="{{notebook_path}}"
16 data-base-kernel-url="{{base_kernel_url}}"
17
16
18 {% endblock %}
17 {% endblock %}
19
18
@@ -121,8 +121,7 b' e.g. ``http://localhost:8888/ipython/``, you can do so with'
121 configuration options like the following (see above for instructions about
121 configuration options like the following (see above for instructions about
122 modifying ``ipython_notebook_config.py``)::
122 modifying ``ipython_notebook_config.py``)::
123
123
124 c.NotebookApp.base_project_url = '/ipython/'
124 c.NotebookApp.base_url = '/ipython/'
125 c.NotebookApp.base_kernel_url = '/ipython/'
126 c.NotebookApp.webapp_settings = {'static_url_prefix':'/ipython/static/'}
125 c.NotebookApp.webapp_settings = {'static_url_prefix':'/ipython/static/'}
127
126
128 Using a different notebook store
127 Using a different notebook store
General Comments 0
You need to be logged in to leave comments. Login now