diff --git a/{{cookiecutter.project_slug}}/config/settings/local.py b/{{cookiecutter.project_slug}}/config/settings/local.py index b3227a2b..504085d6 100644 --- a/{{cookiecutter.project_slug}}/config/settings/local.py +++ b/{{cookiecutter.project_slug}}/config/settings/local.py @@ -9,6 +9,8 @@ Local settings """ from .common import * # noqa +import socket +import os # DEBUG # ------------------------------------------------------------------------------ @@ -47,7 +49,11 @@ CACHES = { MIDDLEWARE_CLASSES += ('debug_toolbar.middleware.DebugToolbarMiddleware',) INSTALLED_APPS += ('debug_toolbar', ) -INTERNAL_IPS = ('127.0.0.1', '10.0.2.2',) +INTERNAL_IPS = ['127.0.0.1', '10.0.2.2', ] +# tricks to have debug toolbar when developing with docker +if os.environ.get('USE_DOCKER') == 'yes': + ip = socket.gethostbyname(socket.gethostname()) + INTERNAL_IPS += [ip[:-1]+"1"] DEBUG_TOOLBAR_CONFIG = { 'DISABLE_PANELS': [ diff --git a/{{cookiecutter.project_slug}}/dev.yml b/{{cookiecutter.project_slug}}/dev.yml index 725ae50e..35282fe6 100644 --- a/{{cookiecutter.project_slug}}/dev.yml +++ b/{{cookiecutter.project_slug}}/dev.yml @@ -22,6 +22,7 @@ services: - postgres environment: - POSTGRES_USER={{cookiecutter.project_slug}} + - USE_DOCKER=yes volumes: - .:/app ports: