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
- 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
# ------------------------------------------------------------------------------

View File

@ -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 %}