# vim: set fileencoding=utf-8
"""
Django settings for myhelpline project.

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

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 sys

# setting default encoding to utf-8
reload(sys)
sys.setdefaultencoding('utf-8')

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


# 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 = 'CHANGE_ME!!!'

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

ALLOWED_HOSTS = []


# Application definition

INSTALLED_APPS = (
    'django.contrib.auth',
    # admin tool apps
    'admin_tools',
    'admin_tools.theming',
    'admin_tools.menu',
    'admin_tools.dashboard',
    'django.contrib.admin',
    'django.contrib.admindocs',
    'django.contrib.contenttypes',
    'django.contrib.humanize',
    'markdown_deux',
    'bootstrapform',
    'django.contrib.sites',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django_countries',
    'admin_tools_stats',
    'genericadmin',
    'mailer',
    'helpline',
    'djangobower',
    'django_nvd3',
    'notifications',
    'avatar',
    'crispy_forms',
    'django_tables2',
    'debug_toolbar',
    'rest_framework',
    'selectable',
    'faq',
    'helpdesk',
    'messaging',
    'corsheaders',
)

MIDDLEWARE_CLASSES = (
    'corsheaders.middleware.CorsMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.locale.LocaleMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.admindocs.middleware.XViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
    'django.middleware.security.SecurityMiddleware',
    'debug_toolbar.middleware.DebugToolbarMiddleware',
)

ROOT_URLCONF = 'myhelpline.urls'

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [os.path.join(BASE_DIR, "templates")],
        '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.template.context_processors.static',
            ],
            'loaders': [
                'django.template.loaders.filesystem.Loader',
                'django.template.loaders.app_directories.Loader',
                'admin_tools.template_loaders.Loader',
            ]
        },
    },
]


WSGI_APPLICATION = 'myhelpline.wsgi.application'


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

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'helpline',
        'USER': 'root',
        'PASSWORD': 'root',
        'HOST': '127.0.0.1',
        'PORT': '',
    }
}


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

LANGUAGE_CODE = 'en-us'

LANGUAGES = (
    ('fr', u'Français'),
    ('en', u'English'),
    ('es', u'Español'),
    ('it', u'Italiano'),
    ('km', u'ភាសាខ្មែរ'),
    ('ne', u'नेपाली'),
    ('nl', u'Nederlands'),
    ('sw', u'Swahili'),
    ('zh-cn', u'简体中文'),
)

LOCALE_PATHS = (os.path.join(BASE_DIR, 'locale'), )

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True

# 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/")

MEDIA_ROOT = "/var/www/html/media/"
MEDIA_URL = "/media/"

AVATAR_CACHE_ENABLED = False

# Django bower settings requirements.
BOWER_COMPONENTS_ROOT = os.path.join(BASE_DIR, "components/")

BOWER_INSTALLED_APPS = (
    'd3#3.4.13',
    'nvd3#1.7.1',
    'admin-lte#v2.3.7',
    'bootstrap#v3.3.7',
    'bootstrap-datepicker#1.6.4',
    'bootstrap3-wysiwyg',
    'jquery#2.2.3',
    'jquery-ui#~1.10.3',
    'jvectormap#1.2.2',
    'ionicons#2.0.1',
    'clipboard#1.5.15',
    'font-awesome#4.7.0',
    'bootstrap-daterangepicker#2.1.25',
    'moment#2.18.1',
)

STATICFILES_FINDERS = ['djangobower.finders.BowerFinder',
                       'django.contrib.staticfiles.finders.FileSystemFinder',
                       'django.contrib.staticfiles.finders.AppDirectoriesFinder']

INTERNAL_IPS = '192.168.86.1'

SHORT_DATETIME_FORMAT = 'Y N j, H:i:s.u'
DATETIME_FORMAT = 'Y N j, H:i:s.u'
TIME_FORMAT = 'H:i:s'
LOGIN_REDIRECT_URL = '/'

# Default service used to report filters
DEFAULT_SERVICE = 'Inbound'

# Default dispositions.
DISPOSITION_CHOICES = (
    ('--', '--'),
    ('Feedback', 'Feedback'),
    ('Request', 'Request'),
    ('Inquiry', 'Inquiry'),
    ('Agent', 'Agent'),
    ('Complaint', 'Complaint'),
    ('Transfer', 'Transfer'),
    ('Silent Call', 'Silent Call'),
    ('Dropped', 'Dropped'),
    ('Prank', 'Prank'),
)

BLACKBOX_API_KEY = ''
BLACKBOX_API_SIGNATURE = ''
BLACKBOX_SHORT_CODE = ''
BLACKBOX_KEYWORD = ''

AFRICASTALKING_API_KEY = ''
AFRICASTALKING_API_USERNAME = ''

SENDSMS_BACKEND = 'custom_sms_backend.custom.AfricasTalkingSmsBackend'

SITE_ID = 1

EMAIL_BACKEND = "mailer.backend.DbBackend"

# Email will be sent to Help Desk Emails on Escalation.
HELPDESK_EMAILS = []


ADMIN_TOOLS_MENU = 'custom_admin_tools.menu.CustomMenu'
ADMIN_TOOLS_INDEX_DASHBOARD = 'custom_admin_tools.dashboard.CustomIndexDashboard'

CORS_ORIGIN_WHITELIST = (
    'localhost:5000',
    '127.0.0.1:5000'
)

SALESFORCE_URL = ''
SALESFORCE_ORGID = ''

SALESFORCE_LEAD_URL = ""
SALESFORCE_LEAD_ORGID = ""

HELPLINE_SPOOL_DIR = ''

try:
    from myhelpline.localsettings import *
except ImportError as e:
    print(e)
    pass
