"""Django settings for PythonServer project.Generated by 'django-admin startproject' using Django 2.0.10.For more information on this file, seehttps://docs.djangoproject.com/en/2.0/topics/settings/For the full list of settings and their values, seehttps://docs.djangoproject.com/en/2.0/ref/settings/"""import osfrom pathlib import Pathimport logging.config# Build paths inside the project like this: os.path.join(BASE_DIR, ...)BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))cur_path = os.path.dirname(os.path.realpath(__file__)) # log_path是存放日志的路径log_path = os.path.join(os.path.dirname(cur_path), 'logs')if not os.path.exists(log_path): os.mkdir(log_path)# Quick-start development settings - unsuitable for production# See https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/# SECURITY WARNING: keep the secret key used in production secret!SECRET_KEY = 'np1==*b=dvt1q6ob_6lunsgbkq0@!1m_v5v0&vln#_caqtq7j*'# SECURITY WARNING: don't run with debug turned on in production!DEBUG = FalseALLOWED_HOSTS = ["*"]# Application definitionINSTALLED_APPS = ['django.contrib.admin','django.contrib.auth','django.contrib.contenttypes','django.contrib.sessions','django.contrib.messages','django.contrib.staticfiles',"mqa.apps.MqaConfig",'rest_framework','captcha',]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',]X_FRAME_OPTIONS = 'SAMEORIGIN'ROOT_URLCONF = 'PythonServer.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 = 'PythonServer.wsgi.application'# Database# https://docs.djangoproject.com/en/2.0/ref/settings/#databasesDATABASES = {'default': {'ENGINE': 'django.db.backends.sqlite3','NAME': os.path.join(BASE_DIR, 'db.sqlite3'),}}# Password validation# https://docs.djangoproject.com/en/2.0/ref/settings/#auth-password-validatorsAUTH_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.0/topics/i18n/LANGUAGE_CODE = 'en-us'TIME_ZONE = 'UTC'USE_I18N = TrueUSE_L10N = TrueUSE_TZ = True# Static files (CSS, JavaScript, Images)# https://docs.djangoproject.com/en/2.0/howto/static-files/STATIC_URL = '/static/'if DEBUG == False:STATIC_ROOT = 'static'else:STATICFILES_DIRS = [os.path.join(BASE_DIR, "static"),]REST_FRAMEWORK = {# 下面这一行表示接口文档的访问权限, AllowAny不做权限限制.# 'DEFAULT_PERMISSION_CLASSES': ('rest_framework.permissions.AllowAny',),# 'EXCEPTION_HANDLER': 'PythonServer.rendererresponse.custom_exception_handler',# 'EXCEPTION_HANDLER': 'rest_framework.views.exception_handler','DEFAULT_SCHEMA_CLASS': 'rest_framework.schemas.coreapi.AutoSchema','DEFAULT_PARSER_CLASSES': ('rest_framework.parsers.JSONParser',),# 'PAGE_SIZE': 10,'PAGINATE_BY': 10,# # 修改默认返回JSON的renderer的类# 'DEFAULT_RENDERER_CLASSES': (# 'ThunderDataServer.rendererresponse.customrenderer',# ),}LOG_CONFIG = {'version': 1,'disable_existing_loggers': False,'formatters': {'simple': {# 'datefmt': '%m-%d-%Y %H:%M:%S''format': '%(asctime)s \"%(pathname)s:%(module)s:%(funcName)s:%(lineno)d\" [%(levelname)s]- %(message)s'}},'handlers': {'console': {'level': 'INFO',# 'class': 'logging.handlers.RotatingFileHandler',# 'level': 'DEBUG','formatter': 'simple','class': 'logging.handlers.TimedRotatingFileHandler',# 'class':"logging.StreamHandler",'filename': 'logs/celery.log','when': 'midnight','encoding': 'utf-8',},},'loggers': {'celery_log': {'handlers': ['console'],'level': 'INFO','propagate': True,}}}logging.config.dictConfig(LOG_CONFIG)# 验证码配置CAPTCHA_IMAGESIZE = (8,45) # 设置captcha图片大小CAPTCHA_LENGTH =4 #字符个数CAPTCHA_TIMEOUT =1 #超时(minutes)*# 输出格式:输入框验证码图片隐藏域•# '%(image)s %(hidden_field)s %(text_field)s'CAPTCHA_OUTPUT_FORMAT ='%(text_field)s %(image)s %(hidden_field)s'CAPTCHA_NOISE_FUNCTIONS =('captcha.helpers.noise_null','captcha.helpers.noise_arcs',#'captcha.helpers.noise_dots',)CAPTCHA_CHALLENGE_FUNCT = 'captcha.helpers.random_char_challenge'LOGIN_URL = "/html/login.html"
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。