From 38a67bc790eb8e82b919c77d8cdbe5fea25c1838 Mon Sep 17 00:00:00 2001 From: Thomas Kluyver Date: Fri, 4 May 2018 22:39:34 +0200 Subject: [PATCH 1/2] Prefer IP address over hostname when available --- notebook/notebookapp.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/notebook/notebookapp.py b/notebook/notebookapp.py index 2be2b92b9c..e1db9d879e 100755 --- a/notebook/notebookapp.py +++ b/notebook/notebookapp.py @@ -1339,11 +1339,10 @@ def init_webapp(self): @property def display_url(self): - hostname = socket.gethostname() - if self.ip in ('localhost', '127.0.0.1', hostname): - ip = self.ip + if self.ip in ('', '0.0.0.0'): + ip = socket.gethostname() else: - ip = hostname + ip = self.ip url = self._url(ip) if self.token: # Don't log full token if it came from config From 8d62e041b27029e82faa564034de90e4fffeacaa Mon Sep 17 00:00:00 2001 From: Thomas Kluyver Date: Sat, 5 May 2018 07:19:30 +0200 Subject: [PATCH 2/2] Add PR to changelog --- docs/source/changelog.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/changelog.rst b/docs/source/changelog.rst index ebc7d08610..bc1a6e9430 100644 --- a/docs/source/changelog.rst +++ b/docs/source/changelog.rst @@ -30,7 +30,7 @@ New features: - The files list now shows file sizes (:ghpull:`3539`) - Add a quit button in the dashboard (:ghpull:`3004`) -- Display hostname in the terminal when running remotely (:ghpull:`3356`) +- Display hostname in the terminal when running remotely (:ghpull:`3356`, :ghpull:`3593`) - Add slides exportation/download to the menu (:ghpull:`3287`) - Add any extra installed nbconvert exporters to the "Download as" menu (:ghpull:`3323`) - Editor: warning when overwriting a file that is modified on disk (:ghpull:`2783`)