"""
Django settings for simpleui_demo project.

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

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

For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.1/ref/settings/
"""
import os
from pathlib import Path

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

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'ik1o7f_6q7&bk#w7_#e=v57dws89wnnc=c12q5td@7fvqq+=y4'

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

ALLOWED_HOSTS = ['*', ]


# Application definition

INSTALLED_APPS = [
    'import_export',
    'simpleui',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'data.apps.DataConfig',
    'app.apps.AppConfig',
]

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 = 'simpleui_demo.urls'

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


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

DATABASES = {
    # 'default': {
    #     'ENGINE': 'django.db.backends.sqlite3',
    #     'NAME': BASE_DIR / 'db.sqlite3',
    # }
     'default': {
            'ENGINE': 'django.db.backends.mysql',
            'NAME': 'django',    #你的数据库名称
            'USER': 'django',   #你的数据库用户名
            'PASSWORD': '982128', #你的数据库密码
            'HOST': '8.129.115.98', #你的数据库主机，留空默认为localhost
            # 'HOST': '192.168.31.85',  # 你的数据库主机，留空默认为localhost
            'PORT': 3306, # 端口
     }
}

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

# LANGUAGE_CODE = 'en-us'
LANGUAGE_CODE = 'zh-hans'

# TIME_ZONE = 'UTC'
TIME_ZONE = 'Asia/Shanghai'

USE_I18N = True

USE_L10N = True

USE_TZ = True


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

STATIC_URL = '/static/'
# 设置上传目录
# STATIC_ROOT = os.path.join(BASE_DIR, 'static')
#
# STATICFILES_DIRS = [
#     os.path.join(BASE_DIR, "static"),
# ]

# 指定simpleui默认的主题,指定一个文件名，相对路径就从simpleui的theme目录读取
# SIMPLEUI_DEFAULT_THEME = 'admin.lte.css'

# 设置simpleui 点击首页图标跳转的地址
# SIMPLEUI_INDEX = 'https://www.88cto.com'

# 首页显示服务器、python、django、simpleui相关信息
# SIMPLEUI_HOME_INFO = False

# 首页显示快速操作
# SIMPLEUI_HOME_QUICK = False

# 首页显示最近动作
# SIMPLEUI_HOME_ACTION = False

# 自定义SIMPLEUI的Logo
# SIMPLEUI_LOGO = 'https://avatars2.githubusercontent.com/u/13655483?s=60&v=4'

# 登录页粒子动画，默认开启，False关闭
SIMPLEUI_LOGIN_PARTICLES = False

# 让simpleui 不要收集相关信息
SIMPLEUI_ANALYSIS = True

# 自定义simpleui 菜单
SIMPLEUI_CONFIG = {
    # 在自定义菜单的基础上保留系统模块
    'system_keep': True,
    # 'menu_display': ['Simpleui', '多级菜单测试', '权限认证', '动态菜单测试'],      # 开启排序和过滤功能, 不填此字段为默认排序和全部显示, 空列表[] 为全部不显示.
    'menus': [
        {
            'name': '工具',
            'icon': 'fa fa-file',
            'models': [
                {
                    'name': 'amz520',
                    'url': 'https://www.amz520.com/',
                    'icon': 'far fa-surprise'
                },
                {
                'name': '独立站需求力图谱',
                'url': 'http://zhishu.baidu.com/v2/main/index.html#/demand/%E7%8B%AC%E7%AB%8B%E7%AB%99?words=%E7%8B%AC%E7%AB%8B%E7%AB%99',
                'icon': 'far fa-surprise'
            },
            {
                'name': 'affiliate需求力图谱',
                'url': 'http://zhishu.baidu.com/v2/main/index.html#/demand/affiliate?words=affiliate',
                'icon': 'far fa-surprise'
            },
                {
                'name': '5118',
                'url': 'https://www.5118.com/seo/newwords/9da7bca7ce27/',
                'icon': 'far fa-surprise'
            }, {
                'name': '站长站',
                'url': 'https://data.chinaz.com/',
                'icon': 'fab fa-github'
            }
            ]
        },
        {
        'app': 'investment',
        'name': '量化投资系统',
        'icon': 'fas fa-code',
        'models': [{
            'name': '回测系统',
            'icon': 'fa fa-user',
            'url': 'http://192.168.31.85:9001/'
        }]
    }],

    'menus_temp': [{
        'name': 'Simpleui',
        'icon': 'fas fa-code',
        'url': 'https://gitee.com/tompeppa/simpleui'
    }, {
        # 自2021.02.01+ 支持多级菜单，models 为子菜单名
        'name': '多级菜单测试',
        'icon': 'fa fa-file',
        'models': [{
            'name': 'Baidu',
            'icon': 'far fa-surprise',
            'models': [
                {
                    'name': '爱奇艺',
                    # 第四级就不支持了，element只支持了3级
                    'models': [
                        {'name': '视频直播'}
                    ]
                }, {
                    'name': '百度问答'
                }
            ]
        }, {
            'name': 'Google',
            'icon': 'far fa-surprise',
            'models': [{
                'name': 'Youtube',
                'icon': 'far fa-surprise'
            }, {
                'name': 'Gmail',
                'icon': 'far fa-surprise'
            }, {
                'name': 'Search',
                'url': 'https://www.google.com'
            }]
        }]
    }, {
        'app': 'auth',
        'name': '权限认证',
        'icon': 'fas fa-user-shield',
        'models': [{
            'name': '用户',
            'icon': 'fa fa-user',
            'url': 'auth/user/'
        }]
    }, {
        'name': '测试',
        'icon': 'fa fa-file',
        'models': [{
            'name': 'Baidu',
            'url': 'http://baidu.com',
            'icon': 'far fa-surprise'
        }, {
            'name': '内网穿透',
            'url': 'https://www.wezoz.com',
            'icon': 'fab fa-github'
        }, {
            'name': '内网穿透',
            'url': 'https://www.wezoz.com',
            'icon': 'fab fa-github'
        }, {
            'name': '登录页嵌套测试',
            'url': '/login'
        }]
    }]
}

# 是否显示默认图标，默认=True
# SIMPLEUI_DEFAULT_ICON = False

# 图标设置，图标参考：
SIMPLEUI_ICON = {
    '系统管理': 'fab fa-apple',
    '员工管理': 'fas fa-user-tie'
}

# 指定simpleui 是否以脱机模式加载静态资源，为True的时候将默认从本地读取所有资源，即使没有联网一样可以。适合内网项目
# 不填该项或者为False的时候，默认从第三方的cdn获取

SIMPLEUI_STATIC_OFFLINE = True

# 设置上传目录
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
# 设置前缀
MEDIA_URL = '/media/'