"""
Django settings for NGKS_Shop project.

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

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

# 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/2.0/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '8d+d!p2jrchjh*8pztc0l7tk7rovgqh4eb0%(jwo3r*ksgmn%+'

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

ALLOWED_HOSTS = ['*']


# Application definition

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    #Libs
    'widget_tweaks',
    'bootstrap3',
    'easy_thumbnails',
    'paypal.standard.ipn',
    'rest_framework',
    #apps
    'core',
    'SGU',
    'catalogo',
    'estoque',
    'checkout',
    'api',
]

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',
    
    'checkout.middleware.cart_item_middleware',
]

ROOT_URLCONF = 'NGKS_Shop.urls'

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': ['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',
                'SGU.context_processors.header',
                'core.context_processors.categorias',
                'core.context_processors.carrinho',
            ],
        },
    },
]
WSGI_APPLICATION = 'NGKS_Shop.wsgi.application'


# Database
# https://docs.djangoproject.com/en/2.0/ref/settings/#databases
"""
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'ngks_shop',
        'USER': 'root',
        'PASSWORD': 'Z3ld4100%',
        'HOST': 'ngksshop.ctvm1wxpmlex.us-east-1.rds.amazonaws.com',
        'PORT': '3306',
    }
}

"""
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'ngks_shop',
        'USER': 'root',
        'PASSWORD': '211196',
        'HOST': 'localhost',
        'PORT': '3306',
    }
}

"""
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
    }
}
"""
# Password validation
# https://docs.djangoproject.com/en/2.0/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
]


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

LANGUAGE_CODE = 'pt-br'

TIME_ZONE = 'America/Sao_Paulo'

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/'

STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')

# FileUpload
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')

#login 
AUTH_USER_MODEL = 'SGU.Usuario'
LOGIN_URL = 'loginEcommerce'
LOGOUT_URL = 'sgu:logout'
AUTHENTICATION_BACKENDS = (
    'django.contrib.auth.backends.ModelBackend',
    'core.backends.ModelBackend',
)

#e-mail
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = 'lmsimpacta@gmail.com'
EMAIL_HOST_PASSWORD = '@impacta123'
EMAIL_PORT = 587

# Thumbnails
THUMBNAIL_ALIASES = {
    '': {
        'imagem_lista_produto': {'size': (200, 250), 'crop': True},
        'imagem_produto':{'size':(500,700), 'crop': True},
        'imagem_banner':{'size':(720,660), 'crop': False},
        'imagem_item':{'size':(100,150), 'crop': False},
    },
}
THUMBNAIL_HIGH_RESOLUTION = True

#MESSAGE
from django.contrib.messages import constants as messages_constants 
MESSAGE_TAGS = {
    messages_constants.DEBUG: 'debug',
    messages_constants.INFO:  'info',
    messages_constants.SUCCESS:'success',
    messages_constants.WARNING:'warning',
    messages_constants.ERROR: 'danger',
}

#PAGSEGURO

PAGSEGURO_TOKEN = 'FBC0605AB7D44E0091DF25007031ECAC'
PAGSEGURO_EMAIL= 'allan.turatti@gmail.com'
PAGSEGURO_SANDBOX = True

#PAYPAL

PAYPAL_TEST = True
PAYPAL_EMAIL= 'allan.turatti@gmail.com'
