"""
Django settings for Qshop project.

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

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 = '^$-^tdybb$$6(1v+12&ld6g29nj1#$5eowg01fhnn9d!v*r$r9'

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

ALLOWED_HOSTS = ["*"]

# Application definition

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'Seller',
    'Buyer',
    'djcelery'
]

MIDDLEWARE = [
    # 全站缓存，一头一尾两条数据
    # 'django.middleware.cache.UpdateCacheMiddleware',
    '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',
    # "Qshop.middleware.MiddleWareTest"
    # 'django.middleware.cache.FetchFromCacheMiddleware'
]

ROOT_URLCONF = 'Qshop.urls'

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

WSGI_APPLICATION = 'Qshop.wsgi.application'

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

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
    }
}

# 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/

LANGUAGE_CODE = 'zh-hans'

TIME_ZONE = 'Asia/Shanghai'

USE_I18N = True

USE_L10N = True

USE_TZ = False

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

STATIC_URL = '/static/'
STATICFILES_DIRS = [
    os.path.join(BASE_DIR, 'static'),
]
# 静态文件的根目录，和STATICFILES_DIRS,MEDIA_URL,MEDIA_ROOT有冲突
# 收集时使用
# STATIC_ROOT = os.path.join(BASE_DIR, 'static')

MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'static')
# The cache backends to use.
CACHES = {
    'default': {
        'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
        'LOCATION':[
            # 本地的memcached的地址  端口
            '127.0.0.1:11211'
        ]
    }
}
CACHE_MIDDLEWARE_KEY_PREFIX = ''
# 全局
CACHE_MIDDLEWARE_SECONDS = 600
CACHE_MIDDLEWARE_ALIAS = 'default'


alipay_public_key_string = """-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA6OqrpXSPjFVifdQ7GP4Sk/crDzb6sjpVmES3OKIs3CNl/XtkgLh3blzUBS+4hvSEZj1wgrxZisNaDhIxgyUwgJjViEFVsvIPzIC7edtbigkaobkuzDahinH2P+x4+DkmAQNuZfQJ/dRC9bC06Zg32U90YqK2498Dy7al0DrbY6feNnMrZKogrFjgr7+wOo1/UtazrN+sH21ol9AY5qdJfsjE0xCY321daFMBUVufitZsibYt9ZYOJQwshn25L79C8FINaxtK1IN7/TVjQ45uqgAjTvAebUs8N841XN6mEeaRof72aJO5F51N5nYGinm4RsAOuwNIMQDNipSeP3eduwIDAQAB
-----END PUBLIC KEY-----"""
alipay_private_key_string = """-----BEGIN RSA PRIVATE KEY-----
MIIEpQIBAAKCAQEA6OqrpXSPjFVifdQ7GP4Sk/crDzb6sjpVmES3OKIs3CNl/XtkgLh3blzUBS+4hvSEZj1wgrxZisNaDhIxgyUwgJjViEFVsvIPzIC7edtbigkaobkuzDahinH2P+x4+DkmAQNuZfQJ/dRC9bC06Zg32U90YqK2498Dy7al0DrbY6feNnMrZKogrFjgr7+wOo1/UtazrN+sH21ol9AY5qdJfsjE0xCY321daFMBUVufitZsibYt9ZYOJQwshn25L79C8FINaxtK1IN7/TVjQ45uqgAjTvAebUs8N841XN6mEeaRof72aJO5F51N5nYGinm4RsAOuwNIMQDNipSeP3eduwIDAQABAoIBADY4KqzhbWkllz/jX755pql7KDLqgYFrwvEnTd+JIRg9xUg0qTituF+gjFqIuVPxJ8EFHGPSpKWAxD3yTkRRK/FDorGNQ/3cC4F3lizPu4duhxyOly5CqWgpD0HiMmbWJtqlidWB8bF87/lxoSufm6Citl0fs6NoDuIlKoRGrzuLLpywpp8UrPn29fkiZEMs+NBedLKASXvEZFK2oPhieE8Qosbxq7uovZHAj2uVjoqDzmJ/mdHoPpQYh1zMIr+2op1twFnT0DnRFm/+RzkAtFpYYTsE+mTgpK0PlH3iqMZCph2qtrBfxvoR9A1pB2/KL+fujnYk6OdQ7qZWasCwO8ECgYEA+ughkDAiDweAh0TYWrsbO8WF9MVqB2WZvz9b0eVT3jimkohSq0DuvDbGcTxPTAOQVXplZjjaONmarMOgBdDHkQWOG/UfFyBA+MARz/dZoHaRpHV5NEBlXB1+Z1MrApB0Pu/yofM7u4BjobrxM/6AiqMW7nr/uTU3ELLmG6GFFpcCgYEA7aUNOK0Gl1891mVCZNefb8MoqBEgEHRTMK0+698JTkB6w/Oto9SnSNH//dKmIduJ3gkKOwaqpFuRQabiin8pmBMILO/xBoEXaqeDkl67oQtZF0qpKi2EqG5GpnqdG8VzMHVbU1UmvAyr8bfZ2cg4i7UjUDrbKubzHlCMh1SZ2n0CgYEAn9PMxX+TwoUh34kAVNOJZorNaP10LCARTx06DTuLMCxgF0mVd5eWO/iccjdbv+0pPPoJq5Mdl0cuW00GG45CAeRLAQ4k7uNR3+Lhtds3kZrV7bATNDCtIH99LK5y4GBKXGkW4wkBDNCdJsHhsiA1m5qGGgXp7f2zBQUgxYsfLyMCgYEAhZQvGFp5yABrG+YTKefh4MqMQdxOb7FTSZs4MRFPg8LOvvJr+hkAZvhTsnMDmyhyGHJwY7ldlcE6pvKNiFfuI2MfR1Mf4g4SAYtjc5T4Vo+wZl07NVAcryg9YjqtsPyNwQFWckL84Nsmk1pKhBX9YtpQnTpYE4d5xOJ1+2Pcj2kCgYEA4ULlgpyEU3FxLQv6RbXwgsQrdUsOLg0uuXoCEGVbqSVFbwd5NYNf6WEqP98wXGWLEvKI/MD0DI2paurtajEysvNqd7svCEmCwl/BlKzCNj+bKkW3f1FImpBFrBrIObRdOJAMBeh3MUpMTExXC4QdVFQyDfuB+4gqqoWZasP4Uio=
-----END RSA PRIVATE KEY-----"""

DING_URL = "https://oapi.dingtalk.com/robot/send?access_token=d92d904a11adbe49c7b022fb57762fcea7f60744ef5afdf2691e2266b5c74155"

# 异步任务
import djcelery

# 进行模块加载
djcelery.setup_loader()
# 任务容器地址，redis数据库地址 1是指redis库
BROKER_URL = "redis://127.0.0.1:6379/1"
# 具体的任务文件,后续要创建的文件
CELERY_IMPORTS = ('CeleryTask.tasks')
# celery时区
CELERY_TIMEZONE = "Asia/Shanghai"
# celery处理器 时scheduler:调度程序
CELERY_SCHEDULER = "djcelery.schedulers.DatabaseScheduler"

# 定时器任务
from celery.schedules import crontab, timedelta

CELERYBEAT_SCHEDULE = {
    u"测试任务": {
        # 任务函数
        "task": "CeleryTask.tasks.ding_send_message",
        # 执行时间
        "schedule": timedelta(seconds=10)
    }
}

ERROR_PATH = os.path.join(BASE_DIR, "error.log")

447060fbb539d79e3488f1a2b57d148167823291
<mask token>

<mask token>
djcelery.setup_loader()
<mask token>

<mask token>
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = '^$-^tdybb$$6(1v+12&ld6g29nj1#$5eowg01fhnn9d!v*r$r9'
DEBUG = True
ALLOWED_HOSTS = ['*']
INSTALLED_APPS = ['django.contrib.admin', 'django.contrib.auth',
    'django.contrib.contenttypes', 'django.contrib.sessions',
    'django.contrib.messages', 'django.contrib.staticfiles', 'Seller',
    'Buyer', 'djcelery']
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 = 'Qshop.urls'
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']}}]
WSGI_APPLICATION = 'Qshop.wsgi.application'
DATABASES = {'default': {'ENGINE': 'django.db.backends.sqlite3', 'NAME': os
    .path.join(BASE_DIR, 'db.sqlite3')}}
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'}
    ]
LANGUAGE_CODE = 'zh-hans'
TIME_ZONE = 'Asia/Shanghai'
USE_I18N = True
USE_L10N = True
USE_TZ = False
STATIC_URL = '/static/'
STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static')]
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'static')
CACHES = {'default': {'BACKEND':
    'django.core.cache.backends.memcached.MemcachedCache', 'LOCATION': [
    '127.0.0.1:11211']}}
CACHE_MIDDLEWARE_KEY_PREFIX = ''
CACHE_MIDDLEWARE_SECONDS = 600
CACHE_MIDDLEWARE_ALIAS = 'default'
alipay_public_key_string = """-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA6OqrpXSPjFVifdQ7GP4Sk/crDzb6sjpVmES3OKIs3CNl/XtkgLh3blzUBS+4hvSEZj1wgrxZisNaDhIxgyUwgJjViEFVsvIPzIC7edtbigkaobkuzDahinH2P+x4+DkmAQNuZfQJ/dRC9bC06Zg32U90YqK2498Dy7al0DrbY6feNnMrZKogrFjgr7+wOo1/UtazrN+sH21ol9AY5qdJfsjE0xCY321daFMBUVufitZsibYt9ZYOJQwshn25L79C8FINaxtK1IN7/TVjQ45uqgAjTvAebUs8N841XN6mEeaRof72aJO5F51N5nYGinm4RsAOuwNIMQDNipSeP3eduwIDAQAB
-----END PUBLIC KEY-----"""
alipay_private_key_string = """-----BEGIN RSA PRIVATE KEY-----
MIIEpQIBAAKCAQEA6OqrpXSPjFVifdQ7GP4Sk/crDzb6sjpVmES3OKIs3CNl/XtkgLh3blzUBS+4hvSEZj1wgrxZisNaDhIxgyUwgJjViEFVsvIPzIC7edtbigkaobkuzDahinH2P+x4+DkmAQNuZfQJ/dRC9bC06Zg32U90YqK2498Dy7al0DrbY6feNnMrZKogrFjgr7+wOo1/UtazrN+sH21ol9AY5qdJfsjE0xCY321daFMBUVufitZsibYt9ZYOJQwshn25L79C8FINaxtK1IN7/TVjQ45uqgAjTvAebUs8N841XN6mEeaRof72aJO5F51N5nYGinm4RsAOuwNIMQDNipSeP3eduwIDAQABAoIBADY4KqzhbWkllz/jX755pql7KDLqgYFrwvEnTd+JIRg9xUg0qTituF+gjFqIuVPxJ8EFHGPSpKWAxD3yTkRRK/FDorGNQ/3cC4F3lizPu4duhxyOly5CqWgpD0HiMmbWJtqlidWB8bF87/lxoSufm6Citl0fs6NoDuIlKoRGrzuLLpywpp8UrPn29fkiZEMs+NBedLKASXvEZFK2oPhieE8Qosbxq7uovZHAj2uVjoqDzmJ/mdHoPpQYh1zMIr+2op1twFnT0DnRFm/+RzkAtFpYYTsE+mTgpK0PlH3iqMZCph2qtrBfxvoR9A1pB2/KL+fujnYk6OdQ7qZWasCwO8ECgYEA+ughkDAiDweAh0TYWrsbO8WF9MVqB2WZvz9b0eVT3jimkohSq0DuvDbGcTxPTAOQVXplZjjaONmarMOgBdDHkQWOG/UfFyBA+MARz/dZoHaRpHV5NEBlXB1+Z1MrApB0Pu/yofM7u4BjobrxM/6AiqMW7nr/uTU3ELLmG6GFFpcCgYEA7aUNOK0Gl1891mVCZNefb8MoqBEgEHRTMK0+698JTkB6w/Oto9SnSNH//dKmIduJ3gkKOwaqpFuRQabiin8pmBMILO/xBoEXaqeDkl67oQtZF0qpKi2EqG5GpnqdG8VzMHVbU1UmvAyr8bfZ2cg4i7UjUDrbKubzHlCMh1SZ2n0CgYEAn9PMxX+TwoUh34kAVNOJZorNaP10LCARTx06DTuLMCxgF0mVd5eWO/iccjdbv+0pPPoJq5Mdl0cuW00GG45CAeRLAQ4k7uNR3+Lhtds3kZrV7bATNDCtIH99LK5y4GBKXGkW4wkBDNCdJsHhsiA1m5qGGgXp7f2zBQUgxYsfLyMCgYEAhZQvGFp5yABrG+YTKefh4MqMQdxOb7FTSZs4MRFPg8LOvvJr+hkAZvhTsnMDmyhyGHJwY7ldlcE6pvKNiFfuI2MfR1Mf4g4SAYtjc5T4Vo+wZl07NVAcryg9YjqtsPyNwQFWckL84Nsmk1pKhBX9YtpQnTpYE4d5xOJ1+2Pcj2kCgYEA4ULlgpyEU3FxLQv6RbXwgsQrdUsOLg0uuXoCEGVbqSVFbwd5NYNf6WEqP98wXGWLEvKI/MD0DI2paurtajEysvNqd7svCEmCwl/BlKzCNj+bKkW3f1FImpBFrBrIObRdOJAMBeh3MUpMTExXC4QdVFQyDfuB+4gqqoWZasP4Uio=
-----END RSA PRIVATE KEY-----"""
DING_URL = (
    'https://oapi.dingtalk.com/robot/send?access_token=d92d904a11adbe49c7b022fb57762fcea7f60744ef5afdf2691e2266b5c74155'
    )
<mask token>
djcelery.setup_loader()
BROKER_URL = 'redis://127.0.0.1:6379/1'
CELERY_IMPORTS = 'CeleryTask.tasks'
CELERY_TIMEZONE = 'Asia/Shanghai'
CELERY_SCHEDULER = 'djcelery.schedulers.DatabaseScheduler'
<mask token>
CELERYBEAT_SCHEDULE = {u'测试任务': {'task':
    'CeleryTask.tasks.ding_send_message', 'schedule': timedelta(seconds=10)}}
ERROR_PATH = os.path.join(BASE_DIR, 'error.log')

<mask token>
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = '^$-^tdybb$$6(1v+12&ld6g29nj1#$5eowg01fhnn9d!v*r$r9'
DEBUG = True
ALLOWED_HOSTS = ['*']
INSTALLED_APPS = ['django.contrib.admin', 'django.contrib.auth',
    'django.contrib.contenttypes', 'django.contrib.sessions',
    'django.contrib.messages', 'django.contrib.staticfiles', 'Seller',
    'Buyer', 'djcelery']
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 = 'Qshop.urls'
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']}}]
WSGI_APPLICATION = 'Qshop.wsgi.application'
DATABASES = {'default': {'ENGINE': 'django.db.backends.sqlite3', 'NAME': os
    .path.join(BASE_DIR, 'db.sqlite3')}}
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'}
    ]
LANGUAGE_CODE = 'zh-hans'
TIME_ZONE = 'Asia/Shanghai'
USE_I18N = True
USE_L10N = True
USE_TZ = False
STATIC_URL = '/static/'
STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static')]
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'static')
CACHES = {'default': {'BACKEND':
    'django.core.cache.backends.memcached.MemcachedCache', 'LOCATION': [
    '127.0.0.1:11211']}}
CACHE_MIDDLEWARE_KEY_PREFIX = ''
CACHE_MIDDLEWARE_SECONDS = 600
CACHE_MIDDLEWARE_ALIAS = 'default'
alipay_public_key_string = """-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA6OqrpXSPjFVifdQ7GP4Sk/crDzb6sjpVmES3OKIs3CNl/XtkgLh3blzUBS+4hvSEZj1wgrxZisNaDhIxgyUwgJjViEFVsvIPzIC7edtbigkaobkuzDahinH2P+x4+DkmAQNuZfQJ/dRC9bC06Zg32U90YqK2498Dy7al0DrbY6feNnMrZKogrFjgr7+wOo1/UtazrN+sH21ol9AY5qdJfsjE0xCY321daFMBUVufitZsibYt9ZYOJQwshn25L79C8FINaxtK1IN7/TVjQ45uqgAjTvAebUs8N841XN6mEeaRof72aJO5F51N5nYGinm4RsAOuwNIMQDNipSeP3eduwIDAQAB
-----END PUBLIC KEY-----"""
alipay_private_key_string = """-----BEGIN RSA PRIVATE KEY-----
MIIEpQIBAAKCAQEA6OqrpXSPjFVifdQ7GP4Sk/crDzb6sjpVmES3OKIs3CNl/XtkgLh3blzUBS+4hvSEZj1wgrxZisNaDhIxgyUwgJjViEFVsvIPzIC7edtbigkaobkuzDahinH2P+x4+DkmAQNuZfQJ/dRC9bC06Zg32U90YqK2498Dy7al0DrbY6feNnMrZKogrFjgr7+wOo1/UtazrN+sH21ol9AY5qdJfsjE0xCY321daFMBUVufitZsibYt9ZYOJQwshn25L79C8FINaxtK1IN7/TVjQ45uqgAjTvAebUs8N841XN6mEeaRof72aJO5F51N5nYGinm4RsAOuwNIMQDNipSeP3eduwIDAQABAoIBADY4KqzhbWkllz/jX755pql7KDLqgYFrwvEnTd+JIRg9xUg0qTituF+gjFqIuVPxJ8EFHGPSpKWAxD3yTkRRK/FDorGNQ/3cC4F3lizPu4duhxyOly5CqWgpD0HiMmbWJtqlidWB8bF87/lxoSufm6Citl0fs6NoDuIlKoRGrzuLLpywpp8UrPn29fkiZEMs+NBedLKASXvEZFK2oPhieE8Qosbxq7uovZHAj2uVjoqDzmJ/mdHoPpQYh1zMIr+2op1twFnT0DnRFm/+RzkAtFpYYTsE+mTgpK0PlH3iqMZCph2qtrBfxvoR9A1pB2/KL+fujnYk6OdQ7qZWasCwO8ECgYEA+ughkDAiDweAh0TYWrsbO8WF9MVqB2WZvz9b0eVT3jimkohSq0DuvDbGcTxPTAOQVXplZjjaONmarMOgBdDHkQWOG/UfFyBA+MARz/dZoHaRpHV5NEBlXB1+Z1MrApB0Pu/yofM7u4BjobrxM/6AiqMW7nr/uTU3ELLmG6GFFpcCgYEA7aUNOK0Gl1891mVCZNefb8MoqBEgEHRTMK0+698JTkB6w/Oto9SnSNH//dKmIduJ3gkKOwaqpFuRQabiin8pmBMILO/xBoEXaqeDkl67oQtZF0qpKi2EqG5GpnqdG8VzMHVbU1UmvAyr8bfZ2cg4i7UjUDrbKubzHlCMh1SZ2n0CgYEAn9PMxX+TwoUh34kAVNOJZorNaP10LCARTx06DTuLMCxgF0mVd5eWO/iccjdbv+0pPPoJq5Mdl0cuW00GG45CAeRLAQ4k7uNR3+Lhtds3kZrV7bATNDCtIH99LK5y4GBKXGkW4wkBDNCdJsHhsiA1m5qGGgXp7f2zBQUgxYsfLyMCgYEAhZQvGFp5yABrG+YTKefh4MqMQdxOb7FTSZs4MRFPg8LOvvJr+hkAZvhTsnMDmyhyGHJwY7ldlcE6pvKNiFfuI2MfR1Mf4g4SAYtjc5T4Vo+wZl07NVAcryg9YjqtsPyNwQFWckL84Nsmk1pKhBX9YtpQnTpYE4d5xOJ1+2Pcj2kCgYEA4ULlgpyEU3FxLQv6RbXwgsQrdUsOLg0uuXoCEGVbqSVFbwd5NYNf6WEqP98wXGWLEvKI/MD0DI2paurtajEysvNqd7svCEmCwl/BlKzCNj+bKkW3f1FImpBFrBrIObRdOJAMBeh3MUpMTExXC4QdVFQyDfuB+4gqqoWZasP4Uio=
-----END RSA PRIVATE KEY-----"""
DING_URL = (
    'https://oapi.dingtalk.com/robot/send?access_token=d92d904a11adbe49c7b022fb57762fcea7f60744ef5afdf2691e2266b5c74155'
    )
import djcelery
djcelery.setup_loader()
BROKER_URL = 'redis://127.0.0.1:6379/1'
CELERY_IMPORTS = 'CeleryTask.tasks'
CELERY_TIMEZONE = 'Asia/Shanghai'
CELERY_SCHEDULER = 'djcelery.schedulers.DatabaseScheduler'
from celery.schedules import crontab, timedelta
CELERYBEAT_SCHEDULE = {u'测试任务': {'task':
    'CeleryTask.tasks.ding_send_message', 'schedule': timedelta(seconds=10)}}
ERROR_PATH = os.path.join(BASE_DIR, 'error.log')

"""
Django settings for Qshop project.

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

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 = '^$-^tdybb$$6(1v+12&ld6g29nj1#$5eowg01fhnn9d!v*r$r9'

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

ALLOWED_HOSTS = ["*"]

# Application definition

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'Seller',
    'Buyer',
    'djcelery'
]

MIDDLEWARE = [
    # 全站缓存，一头一尾两条数据
    # 'django.middleware.cache.UpdateCacheMiddleware',
    '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',
    # "Qshop.middleware.MiddleWareTest"
    # 'django.middleware.cache.FetchFromCacheMiddleware'
]

ROOT_URLCONF = 'Qshop.urls'

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

WSGI_APPLICATION = 'Qshop.wsgi.application'

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

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
    }
}

# 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/

LANGUAGE_CODE = 'zh-hans'

TIME_ZONE = 'Asia/Shanghai'

USE_I18N = True

USE_L10N = True

USE_TZ = False

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

STATIC_URL = '/static/'
STATICFILES_DIRS = [
    os.path.join(BASE_DIR, 'static'),
]
# 静态文件的根目录，和STATICFILES_DIRS,MEDIA_URL,MEDIA_ROOT有冲突
# 收集时使用
# STATIC_ROOT = os.path.join(BASE_DIR, 'static')

MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'static')
# The cache backends to use.
CACHES = {
    'default': {
        'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
        'LOCATION':[
            # 本地的memcached的地址  端口
            '127.0.0.1:11211'
        ]
    }
}
CACHE_MIDDLEWARE_KEY_PREFIX = ''
# 全局
CACHE_MIDDLEWARE_SECONDS = 600
CACHE_MIDDLEWARE_ALIAS = 'default'


alipay_public_key_string = """-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA6OqrpXSPjFVifdQ7GP4Sk/crDzb6sjpVmES3OKIs3CNl/XtkgLh3blzUBS+4hvSEZj1wgrxZisNaDhIxgyUwgJjViEFVsvIPzIC7edtbigkaobkuzDahinH2P+x4+DkmAQNuZfQJ/dRC9bC06Zg32U90YqK2498Dy7al0DrbY6feNnMrZKogrFjgr7+wOo1/UtazrN+sH21ol9AY5qdJfsjE0xCY321daFMBUVufitZsibYt9ZYOJQwshn25L79C8FINaxtK1IN7/TVjQ45uqgAjTvAebUs8N841XN6mEeaRof72aJO5F51N5nYGinm4RsAOuwNIMQDNipSeP3eduwIDAQAB
-----END PUBLIC KEY-----"""
alipay_private_key_string = """-----BEGIN RSA PRIVATE KEY-----
MIIEpQIBAAKCAQEA6OqrpXSPjFVifdQ7GP4Sk/crDzb6sjpVmES3OKIs3CNl/XtkgLh3blzUBS+4hvSEZj1wgrxZisNaDhIxgyUwgJjViEFVsvIPzIC7edtbigkaobkuzDahinH2P+x4+DkmAQNuZfQJ/dRC9bC06Zg32U90YqK2498Dy7al0DrbY6feNnMrZKogrFjgr7+wOo1/UtazrN+sH21ol9AY5qdJfsjE0xCY321daFMBUVufitZsibYt9ZYOJQwshn25L79C8FINaxtK1IN7/TVjQ45uqgAjTvAebUs8N841XN6mEeaRof72aJO5F51N5nYGinm4RsAOuwNIMQDNipSeP3eduwIDAQABAoIBADY4KqzhbWkllz/jX755pql7KDLqgYFrwvEnTd+JIRg9xUg0qTituF+gjFqIuVPxJ8EFHGPSpKWAxD3yTkRRK/FDorGNQ/3cC4F3lizPu4duhxyOly5CqWgpD0HiMmbWJtqlidWB8bF87/lxoSufm6Citl0fs6NoDuIlKoRGrzuLLpywpp8UrPn29fkiZEMs+NBedLKASXvEZFK2oPhieE8Qosbxq7uovZHAj2uVjoqDzmJ/mdHoPpQYh1zMIr+2op1twFnT0DnRFm/+RzkAtFpYYTsE+mTgpK0PlH3iqMZCph2qtrBfxvoR9A1pB2/KL+fujnYk6OdQ7qZWasCwO8ECgYEA+ughkDAiDweAh0TYWrsbO8WF9MVqB2WZvz9b0eVT3jimkohSq0DuvDbGcTxPTAOQVXplZjjaONmarMOgBdDHkQWOG/UfFyBA+MARz/dZoHaRpHV5NEBlXB1+Z1MrApB0Pu/yofM7u4BjobrxM/6AiqMW7nr/uTU3ELLmG6GFFpcCgYEA7aUNOK0Gl1891mVCZNefb8MoqBEgEHRTMK0+698JTkB6w/Oto9SnSNH//dKmIduJ3gkKOwaqpFuRQabiin8pmBMILO/xBoEXaqeDkl67oQtZF0qpKi2EqG5GpnqdG8VzMHVbU1UmvAyr8bfZ2cg4i7UjUDrbKubzHlCMh1SZ2n0CgYEAn9PMxX+TwoUh34kAVNOJZorNaP10LCARTx06DTuLMCxgF0mVd5eWO/iccjdbv+0pPPoJq5Mdl0cuW00GG45CAeRLAQ4k7uNR3+Lhtds3kZrV7bATNDCtIH99LK5y4GBKXGkW4wkBDNCdJsHhsiA1m5qGGgXp7f2zBQUgxYsfLyMCgYEAhZQvGFp5yABrG+YTKefh4MqMQdxOb7FTSZs4MRFPg8LOvvJr+hkAZvhTsnMDmyhyGHJwY7ldlcE6pvKNiFfuI2MfR1Mf4g4SAYtjc5T4Vo+wZl07NVAcryg9YjqtsPyNwQFWckL84Nsmk1pKhBX9YtpQnTpYE4d5xOJ1+2Pcj2kCgYEA4ULlgpyEU3FxLQv6RbXwgsQrdUsOLg0uuXoCEGVbqSVFbwd5NYNf6WEqP98wXGWLEvKI/MD0DI2paurtajEysvNqd7svCEmCwl/BlKzCNj+bKkW3f1FImpBFrBrIObRdOJAMBeh3MUpMTExXC4QdVFQyDfuB+4gqqoWZasP4Uio=
-----END RSA PRIVATE KEY-----"""

DING_URL = "https://oapi.dingtalk.com/robot/send?access_token=d92d904a11adbe49c7b022fb57762fcea7f60744ef5afdf2691e2266b5c74155"

# 异步任务
import djcelery

# 进行模块加载
djcelery.setup_loader()
# 任务容器地址，redis数据库地址 1是指redis库
BROKER_URL = "redis://127.0.0.1:6379/1"
# 具体的任务文件,后续要创建的文件
CELERY_IMPORTS = ('CeleryTask.tasks')
# celery时区
CELERY_TIMEZONE = "Asia/Shanghai"
# celery处理器 时scheduler:调度程序
CELERY_SCHEDULER = "djcelery.schedulers.DatabaseScheduler"

# 定时器任务
from celery.schedules import crontab, timedelta

CELERYBEAT_SCHEDULE = {
    u"测试任务": {
        # 任务函数
        "task": "CeleryTask.tasks.ding_send_message",
        # 执行时间
        "schedule": timedelta(seconds=10)
    }
}

ERROR_PATH = os.path.join(BASE_DIR, "error.log")
