djangobook记录
2015-06-12 20:00
477 查看
最近学习了下django,准备自己搭建一个共同学习医学的网站,认真读了最著名的djangobook
http://www.djangobook.com我装的1.6,他讲的是1.4,中间遇到了几个问题,在这里记录一下,如果有同学也遇到可以参考一下.
再看chapter06.html 这是第六章,做后台的时候,注意这么一段话:
Make sure MIDDLEWARE_CLASSES contains'django.middleware.common.CommonMiddleware','django.contrib.messages.middleware.MessageMiddleware','django.contrib.sessions.middleware.SessionMiddleware' and'django.contrib.auth.middleware.AuthenticationMiddleware'. (Again,
if you’re following along, note that we commented them out in Chapter 5,
so uncomment them.)
这段话说明完成后台时MIDDLEWARE_CLASSES需要包含的类,注意, 包含的时候,the SessionMiddleware must before MessageMiddleware!!!,session的类一定要在message之前,先后加载一定不能反,否则就会报错,不能按书上的顺序.
再往下看有这莫一段:
http://www.djangobook.com我装的1.6,他讲的是1.4,中间遇到了几个问题,在这里记录一下,如果有同学也遇到可以参考一下.
再看chapter06.html 这是第六章,做后台的时候,注意这么一段话:
Make sure MIDDLEWARE_CLASSES contains'django.middleware.common.CommonMiddleware','django.contrib.messages.middleware.MessageMiddleware','django.contrib.sessions.middleware.SessionMiddleware' and'django.contrib.auth.middleware.AuthenticationMiddleware'. (Again,
if you’re following along, note that we commented them out in Chapter 5,
so uncomment them.)
这段话说明完成后台时MIDDLEWARE_CLASSES需要包含的类,注意, 包含的时候,the SessionMiddleware must before MessageMiddleware!!!,session的类一定要在message之前,先后加载一定不能反,否则就会报错,不能按书上的顺序.
再往下看有这莫一段:
Adding Your Models to the Admin Site
Within the books directory (mysite/books), create a file calledadmin.py, and type in the following lines of code:from django.contrib import admin admin.site.register(Publisher) admin.site.register(Author) admin.site.register(Book) 这段之中,加粗的import可能会出现问题,如果books里面的类和admin.py在同一文件夹下,直接 from mysite.books.models 改为from models就可以导入类,不然需要sys.path.append,根据书上会报错,这是一个ImportError问题,具体见 http://my.oschina.net/leejun2005/blog/109679[/code]
本文出自 “linuxmint17安装” 博客,请务必保留此出处http://crazylearning.blog.51cto.com/9904172/1661396
相关文章推荐
- Google Guava Collections 使用介绍
- django 学习笔记
- category.DEFAULT
- Google 为什么要把最重要的秘密开源?
- CloudXNS,智解析你可以做的更好
- 在goroutine里并发调用sshagent出现panic的解决方案
- 用看板做敏捷开发
- 敏捷开发流程及敏捷工具
- gRPC版本的 Google APIs
- 简单的敏捷工具更受敏捷开发团队青睐
- Levenberg–Marquardt algorithm
- 让敏捷工具在敏捷开发中发挥高效作用
- Gauss-Newton algorithm
- Lucas-Kanade algorithm
- 【Perceptron Learning Algorithm】林轩田机器学习基石
- 安全攻击:webgoat课程笔记
- Django 开启 服务提示错误error 10013
- golang发送xlsx文件到浏览器端
- django自定义过滤器函数
- Analysis of Algorithms-InsertSort