TypeError例外:むしろコンテキスト最後RequestContextの中で辞書でなければなりません。
DEF指数(要求):
間違った時間を報告しました:
# 1.加载模板文件
temp = loader.get_template('booktest/index.html')
# 2. 定义模板上下文,给模板文件传递数据
# context= RequestContext(request,{}) #这样会报上面的错 错误
context = {} #改成这样就可以了 正确
# 3. 模板渲染,产生标准的html内容
res_html = temp.render(context)
# 4.返回给浏览器
return HttpResponse(res_html)