"""
Django settings for myproject project.

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

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

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

import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
#BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
BASE_DIR = "/home/reindicator/public_html/dev.cartoV4/"

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

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '5b0&ei&ux0(wgs^)9rz@f3v$(*a0$^-_u+i#^tvn!rla@_q=a-'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = ['*']


# Application definition

INSTALLED_APPS = [
    'webmap.apps.WebmapConfig',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
]

MIDDLEWARE = [
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

ROOT_URLCONF = 'myproject.urls'

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': ['webmap/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',
            ],
        },
    },
]

WSGI_APPLICATION = 'myproject.wsgi.application'


# Database
# https://docs.djangoproject.com/en/2.1/ref/settings/#databases

DATABASES = {
    'default': {
        'ENGINE':   'django.db.backends.postgresql',
        'NAME':     'reindica_dev_cartoV4_db',
        'USER':     'reindicator',
        'PASSWORD': '28LtF1vJlnn5',
        'HOST':     '',
        'PORT':     '',
    }
}


# Password validation
# https://docs.djangoproject.com/en/2.1/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
    {
        'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
    },
]


# Internationalization
# https://docs.djangoproject.com/en/2.1/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True

PDFCROWD_USERNAME = 'REIndicator'
PDFCROWD_API_KEY = '35e562eccf2070bf95d1a0082e784246'

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

# Media
MEDIA_ROOT  = os.path.join(BASE_DIR, 'reindicator_media_dev_a')
#MEDIA_ROOT  = '/home/reindicator/webapps/reindicator_media_dev_a/'
MEDIA_URL   = '/media/'


# Login/out redirects
LOGIN_REDIRECT_URL = '/'
LOGOUT_REDIRECT_URL = '/'

# Emails
# EMAIL_HOST = 'mail.reindicator.com'
# EMAIL_PORT = 587
# EMAIL_HOST_USER = 'alex@reindicator.com'
# EMAIL_HOST_PASSWORD = 'Waccabuc1234'
# EMAIL_USE_TLS = True
# DEFAULT_FROM_EMAIL = 'REIndicator Support <support@reindicator.com>'
# EMAIL_HOST = 'smtp.gmail.com'
# EMAIL_PORT = 587
# EMAIL_HOST_USER = 'harrykein.god@gmail.com'
# EMAIL_HOST_PASSWORD = 'zerfgihvztlawvdc'
# EMAIL_USE_TLS = True
# DEFAULT_FROM_EMAIL = 'REIndicator Support <support@reindicator.com>'
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_HOST_USER = 'admin@reindicator.com'
EMAIL_HOST_PASSWORD = 'ezwxkfbxkbpczxbh'
EMAIL_USE_TLS = True
DEFAULT_FROM_EMAIL = 'REIndicator Support <support@reindicator.com>'

AUTHENTICATION_BACKENDS = (
    'webmap.externalSettings.UserNameBackend',
    'django.contrib.auth.backends.ModelBackend'
)

SESSION_EXPIRE_AT_BROWSER_CLOSE = True
#SESSION_COOKIE_AGE = 60 * 60 * 24