Django(settings.py配置)

    博客分类:

  • python
djangosettings.py
1. 修改时区:

默认为:TIME_ZONE = 'America/Chicago'

修改为:TIME_ZONE = 'Asia/Shanghai'

2. 默认的url:

ROOT_URLCONF = 'mysite.urls'

3. 模板位置:

TEMPLATE_DIRS = (.....)

Java代码
  1. importos.path
  2. TEMPLATE_DIRS=(
  3. #'/home/tony/djcode/mysite/templates',
  4. os.path.join(os.path.dirname(__file__),'templates').replace('\\','/'),
  5. )
   import os.path
TEMPLATE_DIRS = (
#'/home/tony/djcode/mysite/templates',
os.path.join(os.path.dirname(__file__),'templates').replace('\\','/'),
)

4. 数据库配置:(MySQL)

Java代码
  1. DATABASES={
  2. 'default':{
  3. 'ENGINE':'mysql',
  4. 'NAME':'projectforge',
  5. 'USER':'root',
  6. 'PASSWORD':'root',
  7. 'HOST':'localhost',
  8. 'PORT':'5432'
  9. }
  10. }

发表回复