"""
Django settings for estmator_project project.

Generated by 'django-admin startproject' using Django 1.8.3.

For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
import dj_database_url

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.8/howto/static-files/
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = os.environ.get('SECRET_KEY', None)

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = os.environ.get('DEBUG', False)
TEMPLATE_DEBUG = DEBUG

ALLOWED_HOSTS = os.environ.get('ALLOWED_HOSTS', '').split()


# Application definition

INSTALLED_APPS = (
    'grappelli',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.sites',
    'est_api',
    'est_profile',
    'est_quote',
    'est_client',
    'registration',
    'bootstrap3',
    'rest_framework',
    'localflavor'
)

SITE_ID = 1
EMAIL_BACKEND = os.environ.get(
    'EMAIL_BACKEND',
    'django.core.mail.backends.console.EmailBackend'
)
ACCOUNT_ACTIVATION_DAYS = 7
REGISTRATION_EMAIL_HTML = False
LOGIN_REDIRECT_URL = '/profile/'

# Grappelli Settings
GRAPPELLI_ADMIN_TITLE = 'Estmator Admin'

MIDDLEWARE_CLASSES = (
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
    'django.middleware.security.SecurityMiddleware',
)

ROOT_URLCONF = 'estmator_project.urls'

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [
            os.path.join(BASE_DIR, 'estmator_project/templates'),
            # os.path.join(BASE_DIR, 'est_client/templates'),
            # os.path.join(BASE_DIR, 'est_profile/templates'),
            # os.path.join(BASE_DIR, 'est_quote/templates'),
        ],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
                "django.core.context_processors.request",
            ],
        },
    },
]

WSGI_APPLICATION = 'estmator_project.wsgi.application'


# Database
# https://docs.djangoproject.com/en/1.8/ref/settings/#databases
DATABASES = {'default': dj_database_url.config(
    default='postgres://localhost:5432/estmator'
    )
}


# Internationalization
# https://docs.djangoproject.com/en/1.8/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = os.environ.get('TIME_ZONE', 'UTC')
USE_I18N = os.environ.get('USE_I18N', True)
USE_L10N = os.environ.get('USE_L10N', True)
USE_TZ = os.environ.get('USE_TZ', True)

@@ -1109,34 +1109,8 @@
 )%0A%0A%0A
-# Application definition%0A%0A
 INST
@@ -1505,16 +1505,34 @@
 vor'%0A)%0A%0A
+%0A# email settings%0A
 SITE_ID 
@@ -1643,16 +1643,423 @@
 kend'%0A)%0A
+EMAIL_HOST = os.environ.get('EMAIL_HOST', None)%0AEMAIL_PORT = os.environ.get('EMAIL_PORT', None)%0AEMAIL_HOST_USER = os.environ.get('EMAIL_HOST_USER', None)%0AEMAIL_HOST_PASSWORD = os.environ.get('EMAIL_HOST_PASSWORD', None)%0AEMAIL_USE_SSL = os.environ.get('EMAIL_USE_SSL', None)%0AEMAIL_USE_TLS = os.environ.get('EMAIL_USE_TLS', None)%0AEMAIL_TIMEOUT = os.environ.get('EMAIL_TIMEOUT', None)%0A%0A# registration settings%0A
 ACCOUNT_
@@ -2110,16 +2110,16 @@
 = False%0A
-
 LOGIN_RE
@@ -2144,16 +2144,17 @@
 file/'%0A%0A
+%0A
 # Grappe

add email settings