"""
Django settings for CIS project.

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

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

For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.1/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.1/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '$%n^81i+mqvb2$w%n2&ynv2x*4w%d!g@se3#7yy+!jlyn=9f$&'




# Application definition

INSTALLED_APPS = [
    'suit',  # 添加suit支持，必须在 'django.contrib.admin',之前
    'mptt',

    'SysSetting.apps.SyssettingConfig', # 或者'SysSetting'
    'BomMan.apps.BommanConfig' ,          #或者'BomMan'
    'ConMan.apps.ConmanConfig' ,          #或者'ConMan'
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
]

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

ROOT_URLCONF = 'CIS.urls'

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [os.path.join(BASE_DIR, 'templates')], # 'DIRS': [],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',  # admin-suit 必须有此行
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]

WSGI_APPLICATION = 'CIS.wsgi.application'

#发布时需要修改  DEBUG=Flase    ALLOWED_HOSTS=['IP']    数据库信息也要修改
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = ['*']
# Database
# https://docs.djangoproject.com/en/2.1/ref/settings/#databases
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME':'CIS',
        'USER':'root',
        'PASSWORD':'123456',
        'HOST':'127.0.0.1',
        'PORT':'3306',
    }
}


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






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



LANGUAGE_CODE = 'zh-hans'#老版本django 'zh_CN'
TIME_ZONE = 'Asia/Shanghai'  # TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = False #False  配合下面的时间格式
USE_TZ = True  # 内部使用建议True，否则有时区问题
SUIT_CONFIG = {
    'ADMIN_NAME': '长飞鑫茂',
    'HEADER_DATE_FORMAT': 'Y-m-d H:i:s',  # suit默认为：'l, j. F Y', suit在admin里设置时间的一个小bug。需要把时间格式指定一下
    'HEADER_TIME_FORMAT':  'Y-m-d',#默认为'H:i',
    'CONFIRM_UNSAVED_CHANGES': True, #Alert will be shown, when you’ll try to leave page, without saving changed form first:
    'MENU_OPEN_FIRST_CHILD': True,#Automatically replaces app’s (parent link) url with url of first model’s url (child):
    'SHOW_REQUIRED_ASTERISK': True,#Automatically adds asterisk symbol * to the end of every required field label:
    'LIST_PER_PAGE': 20,
}

STATIC_URL = '/static/'
STATIC_ROOT = 'static' #指向本工程下的static文件夹



STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'collectstatic')
STATICFILES_DIRS = (os.path.join(BASE_DIR, 'CIS/static'),)
#STATICFILES_DIRS值为tuple类型,单个也要加逗号;testdj为项目名,自己写的时候可按照自己要求更改
