Show More
@@ -410,6 +410,20 b' class NotebookApp(BaseIPythonApplication):' | |||
|
410 | 410 | ip = Unicode('localhost', config=True, |
|
411 | 411 | help="The IP address the notebook server will listen on." |
|
412 | 412 | ) |
|
413 | def _ip_default(self): | |
|
414 | """Return localhost if available, 127.0.0.1 otherwise. | |
|
415 | ||
|
416 | On some (horribly broken) systems, localhost cannot be bound. | |
|
417 | """ | |
|
418 | s = socket.socket() | |
|
419 | try: | |
|
420 | s.bind(('localhost', 0)) | |
|
421 | except socket.error as e: | |
|
422 | self.log.warn("Cannot bind to localhost, using 127.0.0.1 as default ip\n%s", e) | |
|
423 | return '127.0.0.1' | |
|
424 | else: | |
|
425 | s.close() | |
|
426 | return 'localhost' | |
|
413 | 427 | |
|
414 | 428 | def _ip_changed(self, name, old, new): |
|
415 | 429 | if new == u'*': self.ip = u'' |
General Comments 0
You need to be logged in to leave comments.
Login now