Fallback to localhost if IP of current hostname can't be determined
This commit is contained in:
parent
2c2a99d738
commit
7b8f882f0d
@ -67,7 +67,10 @@ def main(argv = None):
|
|||||||
|
|
||||||
def detect_listen_opts(address, port):
|
def detect_listen_opts(address, port):
|
||||||
if address is None:
|
if address is None:
|
||||||
|
try:
|
||||||
address = socket.gethostbyname(socket.gethostname())
|
address = socket.gethostbyname(socket.gethostname())
|
||||||
|
except socket.error:
|
||||||
|
address = "127.0.0.1"
|
||||||
|
|
||||||
if port is None:
|
if port is None:
|
||||||
# test if we can use port 80
|
# test if we can use port 80
|
||||||
|
Loading…
Reference in New Issue
Block a user