第一次印刷
- 第3章 - 3.4.2 - 52 页,感谢 @止沸 的指正
- 拼写错误,少了个s,错误内容:
MIDDLEWARE = [ 'student.middleware.TimeItMiddleware', # 省略其他 ]
- 修订为:
MIDDLEWARE = [ 'student.middlewares.TimeItMiddleware', # 省略其他 ]
- 第4章 - 4.2.1 小节 - 70页,感谢 @Yangzhedi 的指正
- 拼写错误,错误内容:
$ source bin/activite - 修订为:
$ source bin/activate
- 第5章 - 5.4.5 - 106 页, 感谢 @jasonqiao36 的指正
- 缩进问题,错误内容:
from django.db.models import F post = Post.objects.get(id=1) post.pv = F('pv') + 1 post.save()
- 修订为:
from django.db.models import F post = Post.objects.get(id=1) post.pv = F('pv') + 1 post.save()
- 第7章 - 7.2.2 小节 - 147页,感谢 @092113219,@faple 的指正
- 缺少返回值,错误内容:
@classmethod def latest_posts(cls): queryset = cls.objects.filter(status=cls.STATUS_NORMAL)| $ source bin/activate |
- 修订为:
@classmethod def latest_posts(cls): queryset = cls.objects.filter(status=cls.STATUS_NORMAL) return queryset
- 第9章 - 9.5.2 - 205 页,感谢 @moneys 的指正
- 拼写错误,错误内容:
if not cache.get(uv_key): increase_uv = True cache.set(pv_key, 1, 24*60*60)
- 修订为:
if not cache.get(uv_key): increase_uv = True cache.set(uv_key, 1, 24*60*60)
第二印
- 第 3 章 - 3.4.3 - 56 页 - 漏写括号, 感谢 @weixianshan 的指正
- 错误内容:
读者可以尝试把test.py文件中的 student.sex_show 改为student.get_sex_display试试。
- 修改为:
读者可以尝试把test.py文件中的 student.sex_show 改为student.get_sex_display()试试。
- 第 6 章 - 6.2.2 - 122 页 typo,感谢 图灵社区 @zerosail @PaperSheep 的指正
- 错误内容:filter_horizontal = ('tags', ) filter_vertical = ('tags', )
- 应改为:filter_horizontal = ('tag', ) filter_vertical = ('tag', )
- 第 6 章 - 6.3.1 - 130 页 - 重复,感谢 图灵社区 @zerosail 的指正
- 错误内容: save_on_top = True
- 该行代码与第129页的倒数第三行代码重复了
- 第8章 - 8.2.2 - 179 页,感谢「Django企业开发实战」 @秋 的指正
- 拼写错误,错误内容:
<span class="card-link">分类:<a href="{% url 'category-list' cate.id %}">{{ post.category.name }}</a></span>
- 修订为:
<span class="card-link">分类:<a href="{% url 'category-list' post.category.id %}">{{ post.category.name }}</a></span>
- 第11章 - 11.1.1 - 237 页,感谢 @eat 的指正
- djangorestframewrok 包错写为 django-rest-framework,错误内容:
pip install django-rest-framework==3.8.2
- 修订为:
pip install djangorestframework==3.8.2
- 第 14 章 - 14.3.4 - 308 页 supervisor 已经支持 Python 3
- 需要修改内容:
对这些配置有了大概的了解后,需要先来安装: ``pip install supervisor``这里需要注意的是,我们对于目前的使用方式有两种,主要是在Python 2和Python 3项目中的差别,对于Python 2的项目,我们会在虚拟环境中安装supervisor。而在Python 3中会在系统上安装,虚拟环境使用系统(全局)的supervisor来管理进程。这么用的原因在于supervisor针对Python 3的版本还没有最终release。 不过对于个人项目可以尝试直接从github安装最新的包: ``pip install git+https://github.com/Supervisor/supervisor``,使用基于兼容了Python3的版本。我们这里也是从github安装目前最新的supervisor(4.0.0dev0)。 或者使用作者fork出来的分支做的release: pip install https://github.com/the5fire/supervisor/archive/4.0.0dev0.zip
- 修改为:
对这些配置有了大概的了解后,需要先来安装: ``pip install supervisor==4.0.2``。
- 第14章 - 14.3.6 - 312 页
- djangorestframewrok 包错写为 django-rest-framework,错误内容:
django-rest-framework==0.1.0
- 修订为:
djangorestframework==3.8.2
提交勘误渠道:
《Django企业开发实战》购买地址:
- from the5fire.com
----EOF-----
微信公众号:Python程序员杂谈