django TypeError: 'module' object is not callable
原因:导入模块时直接把模块当函数使用
from rest_framework import reverse #import reverse module
@api_view(("GET",))
def api_root(request, format=None):
return Response({
"user": reverse("user-list", request=request, fromat=format),
"snippet": reverse("snippet-list", request=request, format=format)
})
导致结果:

解决方法:引入正确的函数而不是模型
from rest_framework.reverse import reverse
django TypeError: 'module' object is not callable的更多相关文章
- TypeError: 'module' object is not callable cp fromhttp://blog.csdn.net/huang9012/article/details/17417133
程序代码 class Person: #constructor def __init__(self,name,sex): self.Name = name ...
- Python TypeError: 'module' object is not callable 原因分析
今天尝试使用pprint进行输出,语句为 >>>import pprint >>>pprint(people) 结果报错,TypeError: 'module' o ...
- PyCharm+selenium环境搭建报错:Traceback (most recent call last): TypeError: 'module' object is not callable
环境搭建好后,代码如下: from selenium import webdriverdriver = webdriver.chrome()driver.get("http://www.ba ...
- python import 错误 TypeError: 'module' object is not callable
python import 错误 TypeError: 'module' object is not callable 在这里,有 Person.py test.py; 在 test.py 里面 im ...
- TypeError: 'module' object is not callable 原因分析
程序代码 class Person: #constructor def __init__(self,name,sex): self.Name = name self.Sex = sex def ToS ...
- pip安装pillow——死循环:[WinError5] & [TypeError:'module' object is not callable]
1.这次本来要安装个pillow,记得以前装了的,怎么这次就不行了.然后,下意识的使用:pip3 install pillow. 发现报错: [TypeError:'module' object is ...
- python -- TypeError: 'module' object is not callable
文件: 代码: import pprintmessge = 'It was a bringht cold day in April,and the clocks were striking thrir ...
- pip install 报错 TypeError: 'module' object is not callable
$ pip install filetype Traceback (most recent call last): File "/usr/local/bin/pip2", line ...
- python 报错——Python TypeError: 'module' object is not callable 原因分析
原因分析:Python导入模块的方法有两种: import module 和 from module import 区别是前者所有导入的东西使用时需加上模块名的限定,而后者则不需要 例: >&g ...
随机推荐
- php explode 用法详解
定义和用法explode() 函数把字符串分割为数组. 语法explode(separator,string,limit)参数 描述 separator 必需.规定在哪里分割字符串.string 必需 ...
- 003-C运算符
运算符 C语言有34种运算符,常见的有加减乘除. 1>算术运算符 1.加 10+2 2.减 20-2 3.乘 12*2 4.除 10/2 5.取余 10%3 = 1; 10%-3 = 1; -1 ...
- Android中layout_weight的属性理解
https://www.zybuluo.com/zzudhj/note/102067 在Android开发过程中,在编写布局文件经常会用layout_weight属性:从字面意思上看权重.比值.按比例 ...
- 使用john破解ubuntu(linux)9.10密码
Title:使用john破解ubuntu(linux)9.10密码 --2011-11-23 15:00 ubuntu 9.10的账户密码加密方式改用sha512了,默认的john是破不了的,还好官方 ...
- Android中的手势
Android对两种手势行为提供了支持:1.对于第一种手势行为而言,Android提供了手势检测,并为手势检测提供了相应的监听器.2.对于第二种手势行为,Android允许开发者添加手势,并提供了相应 ...
- Android调用系统相机和文件浏览器
//拍照功能,调用系统的相机功能 Intent intent2 = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); startActivityForResul ...
- 九度oj 1482:玛雅人的密码
题意:输入一个长度为n(2<=n<=13)的字符串(所有字符为'0','1'或'2'),通过交换相邻的两个字符,至少要交换多少次才能处出现字串"2012",输出这个值, ...
- CCF 送货 + 欧拉路模板
#include <bits/stdc++.h> using namespace std; stack<int> st; vector<]; ][]; ],cp[]; i ...
- 执行npm安装模块的命令 Cannot find module
npm 安装了 appium 和 appium-doctor 运行命令,appium-doctor 提示找不到模块: C:\Users\autotest>appiummodule.js:471 ...
- 数组字符串与指针字符串的区别 char s[]="***" 和char *s="***"的区别
char s[] = "wangshihui"; char *s = "wangshihui"; 皆宣告了s字符串,在C-style string的函数皆可使用 ...