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.2/howto/deployment/checkList/
# Security WARNING: keep the secret key used in production secret!
SECRET_KEY = ‘aevaeh8vi8$%ih#^w#2y%2zgs3c%lqrslwl5r*0mf=_l+(_ndb‘
# 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‘,
‘app001.apps.App001Config‘,
]
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 = ‘riskmobile.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‘,
‘django.template.context_processors.static‘,
‘django.template.context_processors.media‘,
],
},
},
]
Wsgi_APPliCATION = ‘riskmobile.wsgi.application‘
# Database
# https://docs.djangoproject.com/en/2.2/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.2/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.2/topics/i18n/
LANGUAGE_CODE = ‘en-us‘
TIME_ZONE = ‘Asia/Shanghai‘
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS,JavaScript,Images)
# https://docs.djangoproject.com/en/2.2/howto/static-files/
STATIC_URL = ‘/static/‘
STATICfileS_Dirs = [
os.path.join(BASE_DIR,"static"),
]
MEDIA_URL = ‘/media/‘
MEDIA_ROOT = os.path.join(BASE_DIR,‘media‘).replace(‘\‘,‘/‘)
以上是内存溢出为你收集整理的Django SETTING 配置全部内容,希望文章能够帮你解决Django SETTING 配置所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)