From 23031a85becd381ee847bc920d12fbed415ee000 Mon Sep 17 00:00:00 2001 From: Srinivas Nyayapati Date: Sun, 18 Jun 2017 11:16:59 -0400 Subject: [PATCH] remove changes from dev.yml and add comment for local.py --- .../config/settings/local.py | 23 +++++++++-------- {{cookiecutter.project_slug}}/dev.yml | 25 +++++++++---------- 2 files changed, 25 insertions(+), 23 deletions(-) diff --git a/{{cookiecutter.project_slug}}/config/settings/local.py b/{{cookiecutter.project_slug}}/config/settings/local.py index d09823d78..efbaf30b2 100644 --- a/{{cookiecutter.project_slug}}/config/settings/local.py +++ b/{{cookiecutter.project_slug}}/config/settings/local.py @@ -1,10 +1,11 @@ -# -*- coding: utf-8 -*- """ Local settings - Run in Debug mode {% if cookiecutter.use_mailhog == 'y' and cookiecutter.use_docker == 'y' %} - Use mailhog for emails +{% elif cookiecutter.use_mailhog == 'y' and cookiecutter.use_docker == 'n' %} +- Use mailhog for emails {% else %} - Use console backend for emails {% endif %} @@ -12,9 +13,7 @@ Local settings - Add django-extensions as app """ -import socket -import os -from .common import * # noqa +from .base import * # noqa # DEBUG # ------------------------------------------------------------------------------ @@ -32,7 +31,7 @@ SECRET_KEY = env('DJANGO_SECRET_KEY', default='CHANGEME!!!') EMAIL_PORT = 1025 {% if cookiecutter.use_mailhog == 'y' and cookiecutter.use_docker == 'y' %} -EMAIL_HOST = env("EMAIL_HOST", default='mailhog') +EMAIL_HOST = env('EMAIL_HOST', default='mailhog') {% elif cookiecutter.use_mailhog == 'y' and cookiecutter.use_docker == 'n' %} EMAIL_HOST = 'localhost' {% else %} @@ -52,15 +51,19 @@ CACHES = { # django-debug-toolbar # ------------------------------------------------------------------------------ -MIDDLEWARE += ('debug_toolbar.middleware.DebugToolbarMiddleware',) -INSTALLED_APPS += ('debug_toolbar', ) +MIDDLEWARE += ['debug_toolbar.middleware.DebugToolbarMiddleware', ] +INSTALLED_APPS += ['debug_toolbar', ] INTERNAL_IPS = ['127.0.0.1', '10.0.2.2', ] +{% if cookiecutter.use_docker == 'y' %} +{# [cookiecutter-django] This is a workaround to flake8 "imported but unused" errors #} +import socket +import os # 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"] - + INTERNAL_IPS += [ip[:-1] + '1'] +{% endif %} DEBUG_TOOLBAR_CONFIG = { 'DISABLE_PANELS': [ 'debug_toolbar.panels.redirects.RedirectsPanel', @@ -70,7 +73,7 @@ DEBUG_TOOLBAR_CONFIG = { # django-extensions # ------------------------------------------------------------------------------ -INSTALLED_APPS += ('django_extensions', ) +INSTALLED_APPS += ['django_extensions', ] # TESTING # ------------------------------------------------------------------------------ diff --git a/{{cookiecutter.project_slug}}/dev.yml b/{{cookiecutter.project_slug}}/dev.yml index fc1394301..899ad8a98 100644 --- a/{{cookiecutter.project_slug}}/dev.yml +++ b/{{cookiecutter.project_slug}}/dev.yml @@ -1,4 +1,4 @@ -version: '2' +on: '2' volumes: postgres_data_dev: {} @@ -12,19 +12,15 @@ services: - postgres_backup_dev:/backups environment: - POSTGRES_USER={{cookiecutter.project_slug}} -{% if cookiecutter.use_mailhog == 'y' %} - mailhog: - image: mailhog/mailhog - ports: - - "8025:8025" -{% endif %} + django: build: context: . dockerfile: ./compose/django/Dockerfile-dev command: /start-dev.sh depends_on: - - postgres + - postgres{% if cookiecutter.use_mailhog == 'y' %} + - mailhog{% endif %} environment: - POSTGRES_USER={{cookiecutter.project_slug}} - USE_DOCKER=yes @@ -32,9 +28,7 @@ services: - .:/app ports: - "8000:8000" - links: - - postgres - {% if cookiecutter.use_mailhog == 'y' %}- mailhog{% endif %} + {% if cookiecutter.use_pycharm == 'y' %} pycharm: build: @@ -46,6 +40,11 @@ services: - POSTGRES_USER={{cookiecutter.project_slug}} volumes: - .:/app - links: - - postgres +{% endif %} + +{% if cookiecutter.use_mailhog == 'y' %} + mailhog: + image: mailhog/mailhog + ports: + - "8025:8025" {% endif %}