Django学习笔记+官方网站

来源:互联网 发布:windows开机不显示壁纸 编辑:程序博客网 时间:2024/05/17 15:57

新手指南: https://django-chinese-docs.readthedocs.org/en/latest/intro/tutorial01.html

1、快速入门

  http://blog.csdn.net/wcc526/article/details/16068299

2、新版django1.6的Hello world 
  http://blog.csdn.net/chenggong2dm/article/details/17394439

3、错误信息:You're using the Django "sites framework" without having set the SITE_ID setting. Create a site in your database and set the SITE_ID setting to fix this error.
  原因:settings.py里# Application definition中添加了'django.contrib.sites'模块后需要设置SITE_ID 
  处理:在settings.py里添加配置:SITE_ID = 1

4、错误信息:(1146, "Table 'django_db.django_site' doesn't exist")
  原因:settings.py里# Application definition中添加了'django.contrib.sites'模块而没有创建相应的表
  解决:python manage.py syncdb

5、访问html时提示UnicodeDecodeErroror等编码错误
  解决:a、在数据库连接语句上添加:charset='utf8',对中文支持好一点。例如:conn=MySQLdb.connect(host="localhost", user="me", passwd="secret", db="mydb", charset='utf8')"
    b、在html文件中, 要加 ,否则如果数据库中的数据有汉字,访问html文件时就有可能会抛出编码异常问题。
0 0
原创粉丝点击