Django错误'str' object is not callable
来源:互联网 发布:重生网络女主播 编辑:程序博客网 时间:2024/06/05 14:53
错误信息:
TypeError at /hello/'str' object is not callableRequest Method: GETRequest URL: http://127.0.0.1:8000/hello/
项目结构:
view.py代码:
from django.http import HttpResponsedef hello(request): return HttpResponse("Hello world ! ")
urls.py代码:
from django.conf.urls import patterns, urlurlpatterns = patterns("", url('^hello/$', "hello",name="hello"),)
原因:
没写应用模块名称,找不到”hello”,
解决:
修改urls.py代码,添加模块名:
from django.conf.urls import patterns, urlurlpatterns = patterns("puhuofile.view", url('^hello/$', "hello",name="hello"),)
或者直接导入hello,这样就不需要模块名:
from django.conf.urls import patterns, urlfrom puhuofile.view import hellourlpatterns = patterns("", url('^hello/$', hello,name="hello"),)
0 0
- Django错误'str' object is not callable
- django 错误 : 'str' object is not callable 解决
- str' object is not callable
- python错误:TypeError: 'str' object is not callable
- TypeError: 'str' object is not callable
- TypeError: 'str' object is not callable
- TypeError: 'str' object is not callable
- TypeError: 'str' object is not callable
- TypeError: 'str' object is not callable
- TypeError: 'str' object is not callable
- TypeError: 'str' object is not callable
- TypeError: 'str' object is not callable
- TypeError: 'str' object is not callable
- TypeError: 'str' object is not callable
- TypeError: 'str' object is not callable
- 有关python:'str' object is not callable
- 《Django学习》遇到的问题:“TypeError:'str' object is not callable"
- 关于错误:'str' object is not callable可能的原因之一
- 非英文键盘组合键失效的一种可能
- 【NOIP2004提高组T4】虫食算-搜索剪枝
- GitHub查找优秀的开源项目和一些资源福利
- 10.31
- SecureCRT 的上传下载(sz/rz)
- Django错误'str' object is not callable
- 使用APK分析器分析您的构建
- Nginx RTMP 模块 nginx-rtmp-module 指令详解
- 单例设计模式
- Scrapy笔记(8)- 文件与图片
- 学习笔记之JavaSE(11)--面向对象编程2
- git 使用步骤
- TCP-IP学习笔记十:RPC架构WebService加入Zookeeper集群的管理
- Linux下修改Mysql的用户(root)的密码