TypeError: view must be a callable or a list/tuple in the case of include()
来源:互联网 发布:14岁 麻省理工 知乎 编辑:程序博客网 时间:2024/06/07 19:47
由于Django版本的原因,导致url.py文件里面的写法不同。
笔者所用的Django版本是1.10,但是按照教程编写url.py如下
from django.conf.urls import urlfrom django.contrib import adminurlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^index/$',"blog.views.index"),]
出现了错误信息:
TypeError: view must be a callable or a list/tuple in the case of include()
这是由于上诉写法是Django旧版本的写法。
应该如下来配置url.py
from django.conf.urls import urlfrom django.contrib import adminfrom blog.views import indexurlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^index/$',index),]
此外笔者还碰到了修改后台支持中文的方法问题。
这里需要修改 LANGUAGE_CODE
#英文# LANGUAGE_CODE = 'en-us'#旧版本的中文写法# LANGUAGE_CODE = 'zh-cn'#Django1.10 简体中文# LANGUAGE_CODE = 'zh-Hans' #Django1.10 繁体中文# LANGUAGE_CODE = 'zh-Hant'
参考资料:
1、http://blog.csdn.net/TH_NUM/article/details/52760667 2017.4.10
2、http://www.cnblogs.com/Eric-Young/p/6600461.html 2017.4.10
2 0
- 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()
- 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()
- 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
- Uncaught (in promise) TypeError: Super expression must either be null or a function
- 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
- TypeError: dist must be a Distribution instance
- The method onClick(View) of type MainActivity must override or implement a supertype method
- Main application must be in the list of application paths
- Parameter must be a descendant of this view 错误
- 面向过程的三种基本结构
- 立即寻址,直接寻址,间接寻址
- freemark-数据列表的html为何要二次解析
- A Hierarchical Deep Convolutional Neural Network for Fast Artistic Style Transfer论文理解
- Java I/O 总结
- TypeError: view must be a callable or a list/tuple in the case of include()
- Reporting Sercvices报表
- Gradle项目Gradlew命令,使用本地库
- Pixhawk原生固件PX4之MPU6000驱动分析
- Intellij IDEA的Hibernate简单应用
- 用Java实现面向对象编程(入门)(四)
- day08_request&response
- Java中能否利用函数参数来返回值
- MQ、JMS以及ActiveMQ