Skip to content

Commit

Permalink
Merge pull request #3593 from takluyver/url-prefer-ipaddr
Browse files Browse the repository at this point in the history
Prefer IP address over hostname when available
  • Loading branch information
takluyver authored May 5, 2018
2 parents 5cfba9c + 8d62e04 commit 11743f1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/source/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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`)
Expand Down
7 changes: 3 additions & 4 deletions notebook/notebookapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 11743f1

Please sign in to comment.