"""
Django settings for website project.

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

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

For the full list of settings and their values, see
https://docs.djangoproject.com/en/5.0/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
# C:/Users/HC/Desktop/视频号/后端/website/MyApi/证书
WX_CERT_PATH = '/www/wwwroot/unapp_admin/证书/apiclient_cert.pem' #生产环境
WX_KEY_PATH = '/www/wwwroot/unapp_admin/证书/apiclient_key.pem' #生产环境
# WX_CERT_PATH = 'C:/Users/HC/Desktop/视频号/后端/website/MyApi/证书/apiclient_cert.pem'
# WX_KEY_PATH = 'C:/Users/HC/Desktop/视频号/后端/website/MyApi/证书/apiclient_key.pem'

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

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-#v*jmev%ibwm-)6fi5ffpb3b@rn_zr9_927nu%(kbxc@uvfj=-'

WX_APP_ID='wxb5a1857369e5809e'
WX_MCH_ID='1674012932'
WX_API_KEY='f229acb2c90b93cbc1439c185a2b26fe'
WX_NOTIFY_URL='https://unapp.guimiaokeji.com/myapp/wx_pay_notify/'
WX_SERIAL_NO='66DB35F836EFD4CBEC66F3815D283A2892310324'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
# settings.py

QINIU_ACCESS_KEY = 'AO6u6sDWi6L9TsPfr4awC7FYP85JTjt3bodZACCM'
QINIU_SECRET_KEY = '2fjxweGtSAEaUdVgDkWEmN7JbBxHBQDv1cLORb9_'
QINIU_BUCKET_NAME = '1726850085'
QINIU_DOMAIN = 'file.guimiaokeji.com'  # 如 http://yourbucket.qiniudn.com


ALLOWED_HOSTS = ['*']


# Application definition

INSTALLED_APPS = [
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'MyApi.apps.MyapiConfig',
    'MyWeb.apps.MywebConfig',
]

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


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

# DATABASES = {
#     'default': {
#         'ENGINE': 'django.db.backends.sqlite3',
#         'NAME': BASE_DIR / 'db.sqlite3',
#     }
# }
DATABASES = {
  'default':
  {
      'ENGINE': 'django.db.backends.mysql',    # 数据库引擎
      'NAME': 'uinapp', # 数据库名称
      'HOST': '81.70.187.27', # 数据库地址，本机 ip 地址 127.0.0.1
      'PORT': 3306, # mysql端口
      'USER': 'uinapp',  # 数据库用户名
      'PASSWORD': '6CnCBxZ77cLredtK', # 数据库密码
      'OPTIONS': {
          'charset': 'utf8mb4',
          'use_unicode': True,
      },
  }
}


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

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'Asia/Shanghai'

USE_I18N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/5.0/howto/static-files/
MEDIA_ROOT = os.path.join(BASE_DIR, 'uploaded_videos')
MEDIA_URL = '/media/'
STATIC_URL = 'static/'
STATICFILES_DIRS = [
    #设置静态文件目录
    os.path.join(BASE_DIR, 'static'),
    BASE_DIR / 'static',
]

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

DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
