"""
Django settings for njuaplusplus project.

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

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

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

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os

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.9/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = YOUR_OWN_SETTINGS

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

ALLOWED_HOSTS = YOUR_OWN_SETTINGS


# Application definition

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'pagedown',
    'datetimewidget',
    'blog.apps.BlogConfig',
    'wechat.apps.WeChatConfig',
    'photos.apps.PhotosConfig',
    'vbuilder.apps.VBuilderConfig',
    'django_user_agents',
    'imagekit',
    'crispy_forms',
    # 'fluent_comments',
    'mycomments',
    'django_comments',
    'threadedcomments',
    'django.contrib.sites',
    'atimelogger',
]

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

ROOT_URLCONF = YOUR_OWN_SETTINGS

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',
                # 'blog.context_processors.debug_mode',
            ],
        },
    },
]

WSGI_APPLICATION = YOUR_OWN_SETTINGS


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

DATABASES = YOUR_OWN_SETTINGS

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

LANGUAGE_CODE = 'zh-CN'

TIME_ZONE = 'Asia/Shanghai'

USE_I18N = True

USE_L10N = True

USE_TZ = True


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

STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static/')

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

SITE_ID = 1
COMMENTS_APP = 'mycomments'
# COMMENTS_APP = 'threadedcomments'

CRISPY_TEMPLATE_PACK = 'bootstrap3'

# fluent-comments settings:
# COMMENTS_APP = 'fluent_comments'
# FLUENT_COMMENTS_USE_EMAIL_MODERATION = True
# FLUENT_COMMENTS_MODERATE_AFTER_DAYS = 60
# FLUENT_COMMENTS_CLOSE_AFTER_DAYS = 3600
# FLUENT_COMMENTS_AKISMET_ACTION = 'moderate'
# AKISMET_API_KEY = None  # Add your Akismet key here to enable Akismet support
# AKISMET_IS_TEST = True  # for development/example apps.
# 
EMAIL_BACKEND = 'django_mailgun.MailgunBackend'
MAILGUN_ACCESS_KEY = YOUR_OWN_SETTINGS
MAILGUN_SERVER_NAME = YOUR_OWN_SETTINGS

ADMINS = (
    # ('Your Name', 'your_email@example.com'),
)

MANAGERS = ADMINS

DEFAULT_FROM_EMAIL = YOUR_OWN_SETTINGS
SERVER_EMAIL = YOUR_OWN_SETTINGS

LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    'filters': {
        'require_debug_false': {
            '()': 'django.utils.log.RequireDebugFalse',
        }
    },
    'handlers': {
        'null': {
            'level': 'DEBUG',
            'class': 'logging.NullHandler',
        },
        'mail_admins': {
            'level': 'ERROR',
            'filters': ['require_debug_false'],
            'class': 'django.utils.log.AdminEmailHandler',
        }
    },
    'loggers': {
        'django.request': {
            'handlers': ['mail_admins'],
            'level': 'ERROR',
            'propagate': True,
        },
        'django.security.DisallowedHost': {
            'handlers': ['null'],
            'propagate': False,
        },
    }
}

ATIMELOGGER = {
    'username': YOUR_OWN_SETTINGS,
    'password': YOUR_OWN_SETTINGS,
}
