automatically update INTERNAL_IPS (#600)

* change local config to automatically update INTERNAL_IPS when developping with docker

* Update local.py

Move import to top

* Update local.py

Bug fix and remove blank line

* Update local.py

* flake8 compliance

* add env var check before updating INTERNAL_IPS

* flake8 compliance

* flake8 compliance
This commit is contained in:
Julien Almarcha 2016-06-18 04:09:08 +02:00 committed by Daniel Roy Greenfeld
parent 3d2385a3b6
commit 13faa21799
2 changed files with 8 additions and 1 deletions

View File

@ -9,6 +9,8 @@ Local settings
""" """
from .common import * # noqa from .common import * # noqa
import socket
import os
# DEBUG # DEBUG
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
@ -47,7 +49,11 @@ CACHES = {
MIDDLEWARE_CLASSES += ('debug_toolbar.middleware.DebugToolbarMiddleware',) MIDDLEWARE_CLASSES += ('debug_toolbar.middleware.DebugToolbarMiddleware',)
INSTALLED_APPS += ('debug_toolbar', ) 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 = { DEBUG_TOOLBAR_CONFIG = {
'DISABLE_PANELS': [ 'DISABLE_PANELS': [

View File

@ -22,6 +22,7 @@ services:
- postgres - postgres
environment: environment:
- POSTGRES_USER={{cookiecutter.project_slug}} - POSTGRES_USER={{cookiecutter.project_slug}}
- USE_DOCKER=yes
volumes: volumes:
- .:/app - .:/app
ports: ports: