"""
Django settings for hydram project.

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

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

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

import os
import datetime

os.environ['ORACLE_HOME'] = 'F:/pthon/driver/instantclient_12_2/'
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

STATIC_URL = '/static/'

STATICFILES_DIRS = (
    BASE_DIR+'/static',
)

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

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '0iz7j8-tg)f@)a)*-e#rxv=8=_&+%5udvcbr*bv%iqi6%_ptis'

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

ALLOWED_HOSTS = ['127.0.0.1','localhost','123.200.0.74']

ALLOWED_IPARRAY = [
        '127.0.0.1',
        '203.76.99.202',
        '203.76.99.210', 
        '203.76.97.60',
        '27.147.194.101',
        '103.58.73.226',
        '203.76.110.122',
        '27.147.194.99',
        '203.76.99.254',
        '203.76.99.202',
        '203.76.96.46',
        '27.147.128.70',
        '203.76.105.91',
        '27.147.232.178',
        '203.76.97.226',
        '27.147.194.100',
        '10.111.111.6',
]

LINK3_BANK_ACCOUNT_NAME = "SCB"
LINK3_BANK_ACCOUNT_NO   = "SCB"

# CONNECT 7 BASIC AUTH INFORMATION
C7_USERNAME = 'l3_api'
C7_PASSWORD = 'api@c7$'
#C7_URL = 'http://crm2.c7solution.com:8080/Link3/ws/com.css.webservice.'
C7_URL = 'http://c7apppri.link3.net:8080/Link3/ws/com.css.webservice.'

# Application definition

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'ortest',
    'rest_framework',
    'rest_framework.authtoken',
]

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',
    'hydram.middleware.OracleClientAuthMiddleware',
]

ROOT_URLCONF = 'hydram.urls'

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [],
        '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 = 'hydram.wsgi.application'


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

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql', 
        'OPTIONS': {
            'sql_mode': 'traditional'
        },
        'NAME': 'hydram',
        'USER': 'root',
        'PASSWORD': '',
        'HOST': 'localhost',   # Or an IP Address that your DB is hosted on
        'PORT': '3306',
    },
    
    'oracle': {
        'ENGINE': 'django.db.backends.oracle',
        #'OPTIONS': {
        #   'threaded': True,
        #   'use_returning_into': False,
        #},
        'NAME': 'hydra',
        'USER': 'AIS_USER_OFFICE',
        'PASSWORD': 'GZsD7Au9lCN29eCVueD18xsO',
        'HOST': '123.200.0.67',
        'PORT': '1521',
    },
    
    'oraclemain': {
        'ENGINE': 'django.db.backends.oracle',
        #'OPTIONS': {
        #   'threaded': True,
        #   'use_returning_into': False,
        #},
        'NAME': 'hydra',
        'USER': 'AIS_PAYMENTS',
        'PASSWORD': 'jV3kDrgJpY4yEZdkxp4eoK7m',
        'HOST': '123.200.0.67',
        'PORT': '1521',
    }
}

REST_FRAMEWORK = {
    'DEFAULT_AUTHENTICATION_CLASSES': (
        'rest_framework_jwt.authentication.JSONWebTokenAuthentication',
        'rest_framework.authentication.SessionAuthentication',
        'rest_framework.authentication.TokenAuthentication',
        'rest_framework.authentication.BasicAuthentication',
    ),
    'DEFAULT_PERMISSION_CLASSES': (
        'rest_framework.permissions.IsAuthenticated',
    )
}

JWT_AUTH = { 
    'JWT_AUTH_HEADER_PREFIX': 'JWT',
    'JWT_EXPIRATION_DELTA': datetime.timedelta(days=365),
    'JWT_AUTH_HEADER_PREFIX': 'Bearer',
    'JWT_ALLOW_REFRESH': True,
    'JWT_REFRESH_EXPIRATION_DELTA': datetime.timedelta(days=1),
}
# Password validation
# https://docs.djangoproject.com/en/2.0/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.0/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'Asia/Dhaka'

USE_I18N = True

USE_L10N = True

USE_TZ = True


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

STATIC_URL = '/static/'
