From 32052df9c9b7c9bf40515dccc9b573dae71c109b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20P=C4=83cioianu?= Date: Mon, 8 Apr 2024 15:26:08 +0300 Subject: [PATCH] Exception handling --- {{cookiecutter.project_slug}}/config/settings/local.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/{{cookiecutter.project_slug}}/config/settings/local.py b/{{cookiecutter.project_slug}}/config/settings/local.py index 7d538b8fd..3d429afb9 100644 --- a/{{cookiecutter.project_slug}}/config/settings/local.py +++ b/{{cookiecutter.project_slug}}/config/settings/local.py @@ -73,8 +73,11 @@ INTERNAL_IPS = ["127.0.0.1", "10.0.2.2"] if env("USE_DOCKER") == "yes": import socket - hostname, _, ips = socket.gethostbyname_ex("host.docker.internal") - INTERNAL_IPS += [".".join(ip.split(".")[:-1] + ["1"]) for ip in ips] + try: + hostname, _, ips = socket.gethostbyname_ex("host.docker.internal") + INTERNAL_IPS += [".".join(ip.split(".")[:-1] + ["1"]) for ip in ips] + except socket.gaierror: + pass {%- if cookiecutter.frontend_pipeline in ['Gulp', 'Webpack'] %} try: _, _, ips = socket.gethostbyname_ex("node")