remove changes from dev.yml and add comment for local.py

This commit is contained in:
Srinivas Nyayapati 2017-06-18 11:16:59 -04:00
parent 9d9e799ba5
commit 23031a85be
2 changed files with 25 additions and 23 deletions

View File

@ -1,10 +1,11 @@
# -*- coding: utf-8 -*-
""" """
Local settings Local settings
- Run in Debug mode - Run in Debug mode
{% if cookiecutter.use_mailhog == 'y' and cookiecutter.use_docker == 'y' %} {% if cookiecutter.use_mailhog == 'y' and cookiecutter.use_docker == 'y' %}
- Use mailhog for emails - Use mailhog for emails
{% elif cookiecutter.use_mailhog == 'y' and cookiecutter.use_docker == 'n' %}
- Use mailhog for emails
{% else %} {% else %}
- Use console backend for emails - Use console backend for emails
{% endif %} {% endif %}
@ -12,9 +13,7 @@ Local settings
- Add django-extensions as app - Add django-extensions as app
""" """
import socket from .base import * # noqa
import os
from .common import * # noqa
# DEBUG # DEBUG
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
@ -32,7 +31,7 @@ SECRET_KEY = env('DJANGO_SECRET_KEY', default='CHANGEME!!!')
EMAIL_PORT = 1025 EMAIL_PORT = 1025
{% if cookiecutter.use_mailhog == 'y' and cookiecutter.use_docker == 'y' %} {% 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' %} {% elif cookiecutter.use_mailhog == 'y' and cookiecutter.use_docker == 'n' %}
EMAIL_HOST = 'localhost' EMAIL_HOST = 'localhost'
{% else %} {% else %}
@ -52,15 +51,19 @@ CACHES = {
# django-debug-toolbar # django-debug-toolbar
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
MIDDLEWARE += ('debug_toolbar.middleware.DebugToolbarMiddleware',) MIDDLEWARE += ['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', ]
{% 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 # tricks to have debug toolbar when developing with docker
if os.environ.get('USE_DOCKER') == 'yes': if os.environ.get('USE_DOCKER') == 'yes':
ip = socket.gethostbyname(socket.gethostname()) ip = socket.gethostbyname(socket.gethostname())
INTERNAL_IPS += [ip[:-1] + "1"] INTERNAL_IPS += [ip[:-1] + '1']
{% endif %}
DEBUG_TOOLBAR_CONFIG = { DEBUG_TOOLBAR_CONFIG = {
'DISABLE_PANELS': [ 'DISABLE_PANELS': [
'debug_toolbar.panels.redirects.RedirectsPanel', 'debug_toolbar.panels.redirects.RedirectsPanel',
@ -70,7 +73,7 @@ DEBUG_TOOLBAR_CONFIG = {
# django-extensions # django-extensions
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
INSTALLED_APPS += ('django_extensions', ) INSTALLED_APPS += ['django_extensions', ]
# TESTING # TESTING
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------

View File

@ -1,4 +1,4 @@
version: '2' on: '2'
volumes: volumes:
postgres_data_dev: {} postgres_data_dev: {}
@ -12,19 +12,15 @@ services:
- postgres_backup_dev:/backups - postgres_backup_dev:/backups
environment: environment:
- POSTGRES_USER={{cookiecutter.project_slug}} - POSTGRES_USER={{cookiecutter.project_slug}}
{% if cookiecutter.use_mailhog == 'y' %}
mailhog:
image: mailhog/mailhog
ports:
- "8025:8025"
{% endif %}
django: django:
build: build:
context: . context: .
dockerfile: ./compose/django/Dockerfile-dev dockerfile: ./compose/django/Dockerfile-dev
command: /start-dev.sh command: /start-dev.sh
depends_on: depends_on:
- postgres - postgres{% if cookiecutter.use_mailhog == 'y' %}
- mailhog{% endif %}
environment: environment:
- POSTGRES_USER={{cookiecutter.project_slug}} - POSTGRES_USER={{cookiecutter.project_slug}}
- USE_DOCKER=yes - USE_DOCKER=yes
@ -32,9 +28,7 @@ services:
- .:/app - .:/app
ports: ports:
- "8000:8000" - "8000:8000"
links:
- postgres
{% if cookiecutter.use_mailhog == 'y' %}- mailhog{% endif %}
{% if cookiecutter.use_pycharm == 'y' %} {% if cookiecutter.use_pycharm == 'y' %}
pycharm: pycharm:
build: build:
@ -46,6 +40,11 @@ services:
- POSTGRES_USER={{cookiecutter.project_slug}} - POSTGRES_USER={{cookiecutter.project_slug}}
volumes: volumes:
- .:/app - .:/app
links: {% endif %}
- postgres
{% if cookiecutter.use_mailhog == 'y' %}
mailhog:
image: mailhog/mailhog
ports:
- "8025:8025"
{% endif %} {% endif %}