# -*- coding: utf-8 -*-
'''
Local settings

- Run in Debug mode
- Use console backend for emails
- Add Django Debug Toolbar
- Add django-extensions as app
'''
import os

from .common import *  # noqa

# DEBUG
# ------------------------------------------------------------------------------
DEBUG = env.bool('DJANGO_DEBUG', default=True)
TEMPLATES[0]['OPTIONS']['debug'] = DEBUG

STATICFILES_DIRS += (
    str(ROOT_DIR.path("bower_components")),
)


TEMPLATES[0]['DIRS'].insert(
    0, str(APPS_DIR.path("templates_dev"))
)

# SECRET CONFIGURATION
# ------------------------------------------------------------------------------
# See: https://docs.djangoproject.com/en/dev/ref/settings/#secret-key
# Note: This key only used for development and testing.
SECRET_KEY = env("DJANGO_SECRET_KEY", default='=&csx-wb@tf7)u=7g9kkca-3t_nm%j&b^**2&py^@yrn-e#fv4')

# Mail settings
# ------------------------------------------------------------------------------
EMAIL_HOST = 'localhost'
EMAIL_PORT = 1025
EMAIL_BACKEND = env('DJANGO_EMAIL_BACKEND',
                    default='django.core.mail.backends.console.EmailBackend')

# CACHING
# ------------------------------------------------------------------------------
CACHES = {
    'default': {
        'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
        'LOCATION': ''
    }
}

# django-debug-toolbar
# ------------------------------------------------------------------------------
MIDDLEWARE_CLASSES += ('debug_toolbar.middleware.DebugToolbarMiddleware',)
INSTALLED_APPS += ('debug_toolbar', )

INTERNAL_IPS = ('127.0.0.1', '10.0.2.2',)

DEBUG_TOOLBAR_CONFIG = {
    'DISABLE_PANELS': [
        'debug_toolbar.panels.redirects.RedirectsPanel',
    ],
    'SHOW_TEMPLATE_CONTEXT': True,
}

# django-extensions
# ------------------------------------------------------------------------------
INSTALLED_APPS += ('django_extensions', )

# TESTING
# ------------------------------------------------------------------------------
TEST_RUNNER = 'django.test.runner.DiscoverRunner'

# Your local stuff: Below this line define 3rd party library settings

# django-autofixture
# ------------------------------------------------------------------------------
INSTALLED_APPS += ('autofixture', )

@@ -2233,12 +2233,589 @@
 fixture', )%0A
+%0Aif 'SQL_LOG' in os.environ:%0A    LOGGING = %7B%0A        'version': 1,%0A        'filters': %7B%0A            'require_debug_true': %7B%0A                '()': 'django.utils.log.RequireDebugTrue',%0A            %7D%0A        %7D,%0A        'handlers': %7B%0A            'console': %7B%0A                'level': 'DEBUG',%0A                'filters': %5B'require_debug_true'%5D,%0A                'class': 'logging.StreamHandler',%0A            %7D%0A        %7D,%0A        'loggers': %7B%0A            'django.db.backends': %7B%0A                'level': 'DEBUG',%0A                'handlers': %5B'console'%5D,%0A            %7D%0A        %7D%0A    %7D%0A

Add SQL_LOG to debug json views