From 6c8538abfe2e37b2ec2114a5770e90852f4732d0 Mon Sep 17 00:00:00 2001 From: Malik S Date: Thu, 8 Mar 2018 18:54:24 +0600 Subject: [PATCH] Add all internal IPs for multiple docker networks (#1520) * Add all internal IPs for multiple docker networks When developing with modified docker-compose.yml that contains multiple network definitions, all networks gateways of the created container should be added to INTERNAL_IPS, otherwise Django-Debug-Toolbar will not work. * Add @flyudvik to contributors --- CONTRIBUTORS.rst | 2 ++ {{cookiecutter.project_slug}}/config/settings/local.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTORS.rst b/CONTRIBUTORS.rst index e1c3cad4..713e72cb 100644 --- a/CONTRIBUTORS.rst +++ b/CONTRIBUTORS.rst @@ -116,6 +116,7 @@ Listed in alphabetical order. Luis Nell `@originell`_ Lukas Klein Lyla Fischer + Malik Sulaimanov `@flyudvik`_ @flyudvik Martin Blech Mathijs Hoogland `@MathijsHoogland`_ Matt Braymer-Hayes `@mattayes`_ @mattayes @@ -196,6 +197,7 @@ Listed in alphabetical order. .. _@eraldo: https://github.com/eraldo .. _@eriol: https://github.com/eriol .. _@eyadsibai: https://github.com/eyadsibai +.. _@flyudvik: https://github.com/flyudvik .. _@garry-cairns: https://github.com/garry-cairns .. _@garrypolley: https://github.com/garrypolley .. _@goldhand: https://github.com/goldhand diff --git a/{{cookiecutter.project_slug}}/config/settings/local.py b/{{cookiecutter.project_slug}}/config/settings/local.py index 2b1b9ddf..6dc27de4 100644 --- a/{{cookiecutter.project_slug}}/config/settings/local.py +++ b/{{cookiecutter.project_slug}}/config/settings/local.py @@ -64,8 +64,8 @@ INTERNAL_IPS = ['127.0.0.1', '10.0.2.2'] import socket import os if os.environ.get('USE_DOCKER') == 'yes': - ip = socket.gethostbyname(socket.gethostname()) - INTERNAL_IPS += [ip[:-1] + '1'] + hostname, _, ips = socket.gethostbyname_ex(socket.gethostname()) + INTERNAL_IPS += [ip[:-1] + '1' for ip in ips] {%- endif %} # django-extensions