解决“TypeError: view must be a callable or a list/tuple in the case of include().”

一、问题描述

“ raise TypeError('view must be a callable or a list/tuple in the case of include().')
TypeError: view must be a callable or a list/tuple in the case of include().”

运行时报错如下:

 二、分析问题

翻译如下:
  提出类型错误('视图必须是可调用的,或者在include()的情况下是列表/元组。')
类型错误:在include()的情况下,view必须是可调用的或list / tuple。

 点开那个函数的定义来看,好像也看不出什么。

但是经过内心长期折磨与腰酸背痛的查看问题,

终于让我知道:

是版本变化之后带来的语法差异。

三、解决问题

方法是:在urls.py中引入视图函数的包,并且填写视图函数时不用单引号或者双引号。

猜你喜欢

转载自blog.csdn.net/lezeqe/article/details/85715891
今日推荐