Skip to content

Commit 11743f1

Browse files
authored
Merge pull request #3593 from takluyver/url-prefer-ipaddr
Prefer IP address over hostname when available
2 parents 5cfba9c + 8d62e04 commit 11743f1

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

docs/source/changelog.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ New features:
3030

3131
- The files list now shows file sizes (:ghpull:`3539`)
3232
- Add a quit button in the dashboard (:ghpull:`3004`)
33-
- Display hostname in the terminal when running remotely (:ghpull:`3356`)
33+
- Display hostname in the terminal when running remotely (:ghpull:`3356`, :ghpull:`3593`)
3434
- Add slides exportation/download to the menu (:ghpull:`3287`)
3535
- Add any extra installed nbconvert exporters to the "Download as" menu (:ghpull:`3323`)
3636
- Editor: warning when overwriting a file that is modified on disk (:ghpull:`2783`)

notebook/notebookapp.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -1339,11 +1339,10 @@ def init_webapp(self):
13391339

13401340
@property
13411341
def display_url(self):
1342-
hostname = socket.gethostname()
1343-
if self.ip in ('localhost', '127.0.0.1', hostname):
1344-
ip = self.ip
1342+
if self.ip in ('', '0.0.0.0'):
1343+
ip = socket.gethostname()
13451344
else:
1346-
ip = hostname
1345+
ip = self.ip
13471346
url = self._url(ip)
13481347
if self.token:
13491348
# Don't log full token if it came from config

0 commit comments

Comments
 (0)