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

 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. linux 添加 $path

    # vim /etc/profile在文档最后,添加:export PATH="/usr/local/src/bin:$PATH"保存,退出,然后运行:#source /etc/p ...

  2. 以前5年只专注于.net,现今开始学习java.

    从2011年毕业至今一直在学习.net和c#,大概几年6月份底开始研究java了. 虽然不知道以后的路是否好走,但是我依然会努力.不放弃! 写这篇文字是为了鼓励自己,也为这段时光留下记忆.加油,红红!

  3. 真正的手机破解wifi密码,aircrack-ng,reaver,仅限mx2(BCM4330芯片)

    仅限mx2(BCM4330芯片),mx可能有戏没测试(BCM4329?),mx3不行. PS:原生安卓应用,非虚拟机 reaver,不知道是啥的看这里http://tieba.baidu.com/p/ ...

  4. POSTGRESQL小玩

    因为CDH上需要用它来建HIVE的元库... 参考: http://www.cnblogs.com/mchina/archive/2012/06/06/2539003.html 一.简介 Postgr ...

  5. DOCKER脚本一例---快速建立大批测试机

    这个会由一系列的脚本构成,比如: 系统重启后,如何快速恢复服务,如何建立网桥(也可一次写入),如何在新系统上快速部署. ADDBRIDGE #!/bin/sh br_name=br100 brctl ...

  6. Qt中 QString 和int, char等的“相互”转换,关键是QString.toLocal8Bit().data();

    Qt中 int ,float ,double转换为QString 有两种方法 1.使用 QString::number(); 如: long a = 63; QString s = QString:: ...

  7. 人工神经网络简介和单层网络实现AND运算--AForge.NET框架的使用(五)

    原文:人工神经网络简介和单层网络实现AND运算--AForge.NET框架的使用(五) 前面4篇文章说的是模糊系统,它不同于传统的值逻辑,理论基础是模糊数学,所以有些朋友看着有点迷糊,如果有兴趣建议参 ...

  8. Eclipse Android源代码新下载方法及关联

    一.下载Android源代码 Android源代码从4.0后就可以使用SDK Manager进行下载,打开SDK Manager就可以看到,已4.4为例: 关联Android源代码 但是老是提示下载失 ...

  9. 8.2.1.5 Engine Condition Pushdown Optimization 引擎条件下推优化

    8.2.1.5 Engine Condition Pushdown Optimization 引擎条件下推优化 这种优化改善了直接比较在一个非索引列和一个常量比较的效率. 在这种情况下, 条件是 下推 ...

  10. 【转】Win8/8.1/Win7小技巧:揪出C盘空间占用的真凶

    原文网址:http://www.ithome.com/html/win8/55496.htm 不少使用Win8.Win8.1的用户不难发现,原先只占用20G大小的系统盘,随着使用时间的增加,C盘的磁盘 ...