mirror of
https://github.com/jupyter/notebook.git
synced 2024-12-27 04:20:22 +08:00
Merge pull request #7608 from minrk/default-location
use default_url for logo link
This commit is contained in:
commit
6192c520b5
@ -137,6 +137,10 @@ class IPythonHandler(AuthenticatedHandler):
|
||||
def base_url(self):
|
||||
return self.settings.get('base_url', '/')
|
||||
|
||||
@property
|
||||
def default_url(self):
|
||||
return self.settings.get('default_url', '')
|
||||
|
||||
@property
|
||||
def ws_url(self):
|
||||
return self.settings.get('websocket_url', '')
|
||||
@ -238,6 +242,7 @@ class IPythonHandler(AuthenticatedHandler):
|
||||
def template_namespace(self):
|
||||
return dict(
|
||||
base_url=self.base_url,
|
||||
default_url=self.default_url,
|
||||
ws_url=self.ws_url,
|
||||
logged_in=self.logged_in,
|
||||
login_available=self.login_available,
|
||||
|
@ -243,7 +243,7 @@ class NotebookWebApplication(web.Application):
|
||||
# set the URL that will be redirected from `/`
|
||||
handlers.append(
|
||||
(r'/?', web.RedirectHandler, {
|
||||
'url' : url_path_join(settings['base_url'], settings['default_url']),
|
||||
'url' : settings['default_url'],
|
||||
'permanent': False, # want 302, not 301
|
||||
})
|
||||
)
|
||||
@ -816,6 +816,9 @@ class NotebookApp(BaseIPythonApplication):
|
||||
if self.allow_origin_pat:
|
||||
self.tornado_settings['allow_origin_pat'] = re.compile(self.allow_origin_pat)
|
||||
self.tornado_settings['allow_credentials'] = self.allow_credentials
|
||||
# ensure default_url starts with base_url
|
||||
if not self.default_url.startswith(self.base_url):
|
||||
self.default_url = url_path_join(self.base_url, self.default_url)
|
||||
|
||||
self.web_app = NotebookWebApplication(
|
||||
self, self.kernel_manager, self.contents_manager,
|
||||
|
@ -83,7 +83,7 @@
|
||||
|
||||
<div id="header">
|
||||
<div id="header-container" class="container">
|
||||
<div id="ipython_notebook" class="nav navbar-brand pull-left"><a href="{{base_url}}tree" title='dashboard'>{% block logo %}<img src='{{static_url("base/images/logo.png") }}' alt='Jupyter Notebook'/>{% endblock %}</a></div>
|
||||
<div id="ipython_notebook" class="nav navbar-brand pull-left"><a href="{{default_url}}" title='dashboard'>{% block logo %}<img src='{{static_url("base/images/logo.png") }}' alt='Jupyter Notebook'/>{% endblock %}</a></div>
|
||||
|
||||
{% block login_widget %}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user