django 单元测试报错: view must be a callable or a list/tuple in the case of include().
来源:互联网 发布:河南红色网络家园 编辑:程序博客网 时间:2024/05/23 19:19
After upgrading to Django 1.10, I get the error:
TypeError: view must be a callable or a list/tuple in the case of include().
My urls.py is as follows:
urlpatterns = [
url(r’^$’, ‘lists.views.home_page’,name = ‘home_page’),
]
将superlists/superlists 中的urls.py 改成如下:
from django.conf.urls import url
from django.contrib import admin
from lists.views import home_page #必须加上
urlpatterns = [
url(r’^$’,home_page ,name=’home_page’) #加粗的部分不能用字符串
url(r’^admin/’, include(admin.site.urls)),
“urls.py” 24L, 859C
重新回到superlists目录下 执行Python manage.py test
测试通过
原因:
django 1.10之后不在支持URL用字符串表示了
http://stackoverflow.com/questions/38744285/django-urls-error-view-must-be-a-callable-or-a-list-tuple-in-the-case-of-includ
- django 单元测试报错: view must be a callable or a list/tuple in the case of include().
- django 运行报错view must be a callable or a list/tuple in the case of include()
- django 运行报错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()
- 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().解决办法
- 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()
- python django1.10解决view must be a callable list/tuple in case of include()
- python 学习---isinstance() arg 2 must be a type or tuple of types
- 解决android报错IllegalArgumentException: parameter must be a descendant of this view
- The type OneInterface cannot be a superinterface of OneInterfaceImpl; a superinterface must be an in
- Caused by: android.view.InflateException: You must specifiy a layout in the include tag: <include la
- Caused by: android.view.InflateException: You must specifiy a layout in the include tag: <include la
- Eclipse启动报错A Java Runtime Environment or Java Developement Kit must be available in order to run ...
- eslipse 开启报错A Java Runtime Environment (JRE) or Java Development Kit (JDK) must be available in orde
- ScrollView中EditText报java.lang.IllegalArgumentException: parameter must be a descendant of this view
- oracle 《is declared in a package specification and must be defined in the package body报错原因》
- July深度学习之一、线性分类器与损失函数
- Leetcode 257 Binary Tree Paths
- opencv计算机视觉学习笔记五
- Cannot find module 'babel-plugin-transform-es2015
- 北航第十二届程序设计竞赛网络预赛__M最小内积
- django 单元测试报错: view must be a callable or a list/tuple in the case of include().
- cordova热更新插件的使用
- 1065. 单身狗(25)
- 八大排序算法图解一----插入排序
- 日志分析与我之缘
- 第十五周OJ——统计字符串种类
- 妙用缓存调用链实现JS方法的重载
- 告诉你SUV到底两驱好还是四驱好
- Centos 7 忘记ROOT密码