"""
Django settings for fc_django2 project.

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

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

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

from pathlib import Path
import os

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent


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

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-i8mtc+!8!qf(pnibu360o^#*^s*g2os8r&#ls$!&^s3bjsst_y'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True # 배포할 때 False , True 로 해야 css #해결방법 https://eunjin3786.tistory.com/240


ALLOWED_HOSTS = ['*']


# Application definition
BATON = {
    'SITE_HEADER' :'패스트캠퍼스 백오피스', 
    'SITE_TITLE' :'패스트캠퍼스 백오피스',
    'INDEX_TITLE':'패스트캠퍼스 관리자페이지',
    'SUPPORT_HREF':'https://fastcampus.co.kr',
    'COPYRIGHT':'copyright © 2020 Otto srl',
    'POWERED_BY' : '<a href="https://fastcampus.co.kr">패스트캠퍼스</a>',
    'MENU_TITLE':'FASTCAM',
    'MENU': (
        { 'type': 'title', 'label': 'main', 'apps': ('auth', 'fcuser', 'product', 'order') },
        {
            'type': 'app',
            'name': 'fcuser',
            'label': '사용자',
            'icon': 'fa fa-lock',
            'default_open': True,
            'models': (
                {
                    'name': 'fcuser',
                    'label': '사용자'
                },
            )
        },
        { 'type': 'free', 'label': '주문', 'children': [
            { 'type': 'model', 'label': '주문', 'name': 'order', 'app': 'order' },
            { 'type': 'free', 'label': '주문날짜', 'url': '/admin/order/order/date_view/' },
        ] },
        {
            'type': 'app',
            'name': 'product',
            'label': '상품',
            'default_open': True,
            'models': (
                {
                    'name': 'product',
                    'label': '상품'
                },
            )
        },
        {
            'type': 'app',
            'name': 'fcuser',
            'label': 'Authentication',
            'icon': 'fa fa-lock',
            'default_open': True,
            'models': (
                {
                    'name': 'fcuser',
                    'label': '사용자'
                },
            )
        },
       
        { 'type': 'free', 'label': '매뉴얼', 'url': '/admin/manual' },
       
    ),
}



INSTALLED_APPS = [
    
    'baton',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.humanize',
    'rest_framework',
    'fcuser.apps.FcuserConfig',
    'order',
    'product',
    'django_db_logger',
    'baton.autodiscover'
]

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',
]

import os 

# LOGGING = {
#     'version': 1,
#     'disable_existing_loggers': False,
#     'formatters': {
#         'verbose': {
#             'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'
#         },
#         'simple': {
#             'format': '%(levelname)s %(asctime)s %(message)s'#,
#             #'style':'{'
#         },
#     },
#     'handlers': {
#         'db_log': {
#             'level': 'DEBUG',
#             'class': 'django_db_logger.db_log_handler.DatabaseLogHandler'
#         }#,
#         # 'file':{
#         #     'level':'DEBUG',
#         #     'class':'logging.FileHandler',
#         #     'filename':'./logs/debug.log',
#         #     'formatter':'simple'
#         # }
#     },
#     'loggers': {
#         'db': {
#             'handlers': ['db_log'],
#             'level': 'DEBUG' #info, warning, error, 
#         }
#     }
# }



ROOT_URLCONF = 'fc_django2.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 = 'fc_django2.wsgi.application'


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

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': BASE_DIR / 'db.sqlite3',
    }
}


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

LANGUAGE_CODE = 'ko-kr'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True


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

STATIC_URL = '/static/' #해결방법 https://eunjin3786.tistory.com/240

# Default primary key field type
# https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field

DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
