1. dubug配置
DEBUG=False
2. 数据库配置
DATABASES = { ‘default‘: { ‘ENGINE‘: ‘django.db.backends.mysql‘, "NAME": "dbname", "USER": "root", "PASSWORD": "xxxx", "HOST": "192.168.11.166", "PORT":3316 } }
3. 模板
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‘, ], }, }, ]
4. 静态文件
STATIC_URL = ‘/static/‘ STATICFILES_DIRS = ( os.path.join(BASE_DIR, "static"), )
5. 时区设置
# LANGUAGE_CODE = ‘en-us‘ # TIME_ZONE = ‘UTC‘ LANGUAGE_CODE = ‘zh-hans‘ TIME_ZONE = ‘Asia/Shanghai‘ USE_I18N = True USE_L10N = True USE_TZ = False
6. session 配置
# 默认值: 1209600 (2周, 以秒计) SESSION_EXPIRE_AT_BROWSER_CLOSE = True SESSION_COOKIE_AGE = 30 * 60
7. 时间格式设置
DATETIME_FORMAT = ‘Y-m-d H:i:s‘ DATE_FORMAT = ‘Y-m-d‘
原文地址:https://www.cnblogs.com/lmx1002/p/8124633.html
时间: 2024-10-29 15:24:58