"""
Django settings for SentimentAnalysis project.

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

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

For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/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__)))


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

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '8sl(w9f+6s3=sijj94*jf2uez5%*-#t@#ris)4*n_fc=zl7kw^'

# Close the session when user closes the browser
SESSION_EXPIRE_AT_BROWSER_CLOSE = True

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
MEDIA_URL = '/'
MEDIA_ROOT = os.path.join(BASE_DIR)

ALLOWED_HOSTS = ['127.0.0.1', '0.0.0.0', '192.168.101.186', '192.168.100.87', '192.168.100.61', '116.68.205.72', 'mis.digital']


# Application definition
USER_AGENTS_CACHE = 'default'
INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
#    'channels',
    'SentimentApp',
    'django_user_agents',
    'ReportApp',
    'ChurnApp',
	'EnyMachineLearningApp',
	'BIReportApp',
	'MotorRegistrationApp'
]

# CHANNEL_LAYERS = {
#     "default": {
#         "BACKEND": "asgiref.inmemory.ChannelLayer",
#         "ROUTING": "SentimentAnalysis.parent_routing.channel_routing",
#     },
# }

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',
    'django_user_agents.middleware.UserAgentMiddleware',
]

ROOT_URLCONF = 'SentimentAnalysis.urls'

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [os.path.join(BASE_DIR, '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 = 'SentimentAnalysis.wsgi.application'


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

DATABASES = {
    'default_old': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
    },
    'default': {
                'NAME': 'Sentiment',
                'ENGINE': 'sql_server.pyodbc',
                'HOST': '192.168.100.139',
                'USER': 'sa',
                'PASSWORD': 'dataport',
                'OPTIONS': {
                            'provider': 'SQLOLEDB',
                            'use_legacy_date_fields': 'True'
                        }
            },
    'SentimentAppDB': {
                'NAME': 'Sentiment',
                'ENGINE': 'sql_server.pyodbc',
                'HOST': '192.168.100.139',
                'USER': 'sa',
                'PASSWORD': 'dataport',
                'OPTIONS': {
                            'provider': 'SQLOLEDB',
                            'use_legacy_date_fields': 'True'
                        }
            },
    'default_aianalysis': {
            'NAME': 'AI',
            'ENGINE': 'sql_server.pyodbc',
            'HOST': '192.168.100.87',
            'USER': 'sa',
            'PASSWORD': 'dataport',
            'OPTIONS': {
                        'provider': 'SQLOLEDB',
                        'use_legacy_date_fields': 'True'
                    }
        },
        
        'PBIMS': {
            'NAME': 'PBIMS',
            'ENGINE': 'sql_server.pyodbc',
            'HOST': '192.168.100.61',
            'USER': 'sa',
            'PASSWORD': 'dataport',
            'OPTIONS': {
                'driver' : 'SQL Server Native Client 11.0',
                'driver_supports_utf8' : 'True',
                'use_legacy_date_fields': 'True'
            }
        },
        'SDMSMIRRORDB': {
            'NAME': 'SDMSMirror',
            'ENGINE': 'sql_server.pyodbc',
            'HOST': '192.168.100.20',
            'USER': 'sa',
            'PASSWORD': 'dataport',  #'PASSWORD': 'flexiload',
            'OPTIONS': {
                'driver' : 'SQL Server Native Client 11.0',
                'driver_supports_utf8' : 'True',
                'use_legacy_date_fields': 'True'
            }
        },
        'ChurnAppDB': {
                #'ENGINE': 'sql_server.pyodbc',
                'NAME': 'RetailChurn',
                'ENGINE': 'sql_server.pyodbc',
                'HOST': '192.168.100.140',
                'USER': 'sa',
                'PASSWORD': 'dataport',
                'driver': 'SQL Server Native Client 10.0',
                'OPTIONS': {
                    'driver' : 'SQL Server Native Client 11.0',
                    'driver_supports_utf8' : 'True',
                    'use_legacy_date_fields': 'True'
                }
            },
		'EnyMachineLearning': {
			'NAME': 'ENYDB',
			'ENGINE': 'sql_server.pyodbc',
			'HOST': '192.168.100.139',
			'USER': 'sa',
			'PASSWORD': 'dataport',
			'OPTIONS': {
				'driver' : 'SQL Server Native Client 11.0',
				'driver_supports_utf8' : 'True',
				'use_legacy_date_fields': 'True'
			}
		},
		'CloudVision': {
			'NAME': 'CloudVision',
			'ENGINE': 'sql_server.pyodbc',
			'HOST': '192.168.100.61',
			'USER': 'sa',
			'PASSWORD': 'dataport',
			'OPTIONS': {
				'driver' : 'SQL Server Native Client 11.0',
				'driver_supports_utf8' : 'True',
				'use_legacy_date_fields': 'True'
			}
		},
		'YamahaRegistration': {
            'NAME': 'YamahaRegistration',
            'ENGINE': 'sql_server.pyodbc',
            'HOST': '192.168.100.61',
            'USER': 'sa',
            'PASSWORD': 'dataport',  #'PASSWORD': 'flexiload',
            'OPTIONS': {
                'driver' : 'SQL Server Native Client 11.0',
                'driver_supports_utf8' : 'True',
                'use_legacy_date_fields': 'True'
            }
        }

}


# Password validation
# https://docs.djangoproject.com/en/1.10/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/1.10/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.10/howto/static-files/

STATIC_URL = '/static/'

EMAIL_USE_TLS = True
DEFAULT_FROM_EMAIL = 'aciapprover111@gmail.com'
SERVER_EMAIL = 'Aciapprover111@gmail.com'
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_HOST_USER = 'Aciapprover111@gmail.com'
EMAIL_HOST_PASSWORD = '112358132134'
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'