Chapter07
7.4.5
現象:運行 celery -A myshop flower
啓動flower失敗
解決方法:查看安裝flower所依賴的tornado版本是否大於6,若是,降級到5.1.1
Chapter08
8.1.2
現象:payment/process.html
模版錯誤
解決方法:
<script src="https://js.braintreegateway.com/web/3.29.0/js/hostedfields.min.js"></script>
改爲
<script src="https://js.braintreegateway.com/web/3.29.0/js/hosted-fields.min.js"></script>
8.4
現象:運行項目時報錯,缺少cairo等依賴
解決方法:安裝cairo
Chapter09
9.2
現象:執行django-admin makemessages --all
,報錯提示Can't find msguniq. Make sure you have GNU gettext tools 0.15 or newer installed
,系統中已安裝過gettext,執行brew link gettext --force
時報錯Error: No such keg: /usr/local/Cellar--force
解決方法:重新安裝gettext
Chapter10
10.5.2
現象:運行開發服務器,打開http://127.0.0.1:8000
,報錯
TypeError at /course/mine/ 'AnonymousUser' object is not iterable
,錯誤代碼定位到return qs.filter(owner=self.request.user)
解決方法:清空瀏覽器緩存,打開上述鏈接時,不是經過驗證的用戶,導致報錯,
可以先打開127.0.0.1:8000/accounts/login
,選擇一個賬戶登陸後,再打開上述鏈接。
10.5.3
現象:報錯TemplateSyntaxError ... is not a registered tag lib
解決方法:在settings中加入以下設置
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
'libraries':{
'courses': 'courses.templatetags.course',
}
},
},
]