Django(settings.py配置)
-
博客分类:
- python
djangosettings.py
1. 修改时区:
默认为:TIME_ZONE = 'America/Chicago'
修改为:TIME_ZONE = 'Asia/Shanghai'
2. 默认的url:
ROOT_URLCONF = 'mysite.urls'
3. 模板位置:
TEMPLATE_DIRS = (.....)
- importos.path
- TEMPLATE_DIRS=(
- #'/home/tony/djcode/mysite/templates',
- os.path.join(os.path.dirname(__file__),'templates').replace('\\','/'),
- )
import os.path TEMPLATE_DIRS = ( #'/home/tony/djcode/mysite/templates', os.path.join(os.path.dirname(__file__),'templates').replace('\\','/'), )
4. 数据库配置:(MySQL)
- DATABASES={
- 'default':{
- 'ENGINE':'mysql',
- 'NAME':'projectforge',
- 'USER':'root',
- 'PASSWORD':'root',
- 'HOST':'localhost',
- 'PORT':'5432'
- }
- }