原因:导入模块时直接把模块当函数使用

 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的更多相关文章

  1. 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   ...

  2. Python TypeError: 'module' object is not callable 原因分析

    今天尝试使用pprint进行输出,语句为 >>>import pprint >>>pprint(people) 结果报错,TypeError: 'module' o ...

  3. PyCharm+selenium环境搭建报错:Traceback (most recent call last): TypeError: 'module' object is not callable

    环境搭建好后,代码如下: from selenium import webdriverdriver = webdriver.chrome()driver.get("http://www.ba ...

  4. python import 错误 TypeError: 'module' object is not callable

    python import 错误 TypeError: 'module' object is not callable 在这里,有 Person.py test.py; 在 test.py 里面 im ...

  5. TypeError: 'module' object is not callable 原因分析

    程序代码 class Person: #constructor def __init__(self,name,sex): self.Name = name self.Sex = sex def ToS ...

  6. pip安装pillow——死循环:[WinError5] & [TypeError:'module' object is not callable]

    1.这次本来要安装个pillow,记得以前装了的,怎么这次就不行了.然后,下意识的使用:pip3 install pillow. 发现报错: [TypeError:'module' object is ...

  7. python -- TypeError: 'module' object is not callable

    文件: 代码: import pprintmessge = 'It was a bringht cold day in April,and the clocks were striking thrir ...

  8. pip install 报错 TypeError: 'module' object is not callable

    $ pip install filetype Traceback (most recent call last): File "/usr/local/bin/pip2", line ...

  9. python 报错——Python TypeError: 'module' object is not callable 原因分析

    原因分析:Python导入模块的方法有两种: import module 和 from module import 区别是前者所有导入的东西使用时需加上模块名的限定,而后者则不需要 例: >&g ...

随机推荐

  1. C++通过OCCI操作Oracle数据库详解

    1.安装OCCI 如果oracle数据库默认没有安装OCCI,可以自己从官网上下载与自己数据库版本一致的API,其中包含四个软件包: oracle-instantclient-sqlplus-10.2 ...

  2. Python自动化运维之2、运算符与数据类型

    python对象的相关术语: python程序中保存的所有数据都是围绕对象这个概念展开的: 程序中存储的所有数据都是对象 每个对象都有一个身份.一个类型和一个值 例如,school='MaGe Lin ...

  3. NET Core & VS Code 之路(2) Web API

    NET Core & VS Code 之路(2) Web API 开发Core项目的条件 Visual Studio 2015 Update 3 .NET Core 1.0.0 - VS 20 ...

  4. Linux C判断字符串是否为数字

    Title:Linux C判断字符串是否为数字  --2013-10-14 15:54 #include <ctype.h> #include <string.h> int I ...

  5. ulimit小结

    1. limits是一个进程的资源,会被子进程继承   2. soft limit -S, hard limits -H hard limits只能被root用户修改,启动的时候会加载配置/etc/s ...

  6. Oracle merge into 使用记录

    符合条件进行更新操作,不符合则进行插入操作. merge into myd_nsrdt n using ('as nsrsbh,'' as nsrmc, ' as nowphone,sysdate a ...

  7. LeetCode _ Word Break

    Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separa ...

  8. VCRedist.exe静默安装方法(转)

    INNO setup 制作安装包  的时候,发布VC++运行时 [Run]Filename: {app}vcredist_x86.exe; Parameters: /q; WorkingDir: {t ...

  9. ActionResult 的返回类型

    大多数操作方法会返回从 ActionResult 中派生的类的实例. ActionResult 类是所有操作结果的基础. 不过,也存在不同的操作结果类型,具体取决于操作方法执行的任务. 例如,最常见的 ...

  10. 【网贷投资手册】P2P行业揭秘

    [网贷投资手册]P2P行业揭秘     (中国电子商务研究中心讯)如果你手头有100元,你会拿它来做什么?跟好朋友去吃一顿?跟女朋友去看场电影?还是……你会想到拿100元去投资吗?100元太少了,买一 ...