flask 基于Werkzeug ..

@moudule.route('/upload', methods=['GET',  'POST'])
def upload_file():
global _flask_app
if request.method == 'POST':
file = request.files['file']
if file and allowed_file(file.filename):
filename = secure_filename(file.filename)
file.save(os.path.join(_flask_app.config['UPLOAD_FOLDER'], filename))
return json.dumps({'info': '上传完成'})
else:
return json.dumps({'info': '文件不存在或者不合法'})
else:
return json.dumps({'info': '方法不支持'})

  请求处理函数中如果直接 :

    return {'info': '方法不支持'}

  就会报 TypeError: 'dict' object is not callable 的错误

python Flask :TypeError: 'dict' object is not callable的更多相关文章

  1. Python: TypeError: 'dict' object is not callable

    问题:  TypeError: 'dict' object is not callable 原因:  dict()是python的一个内建函数,如果将dict自定义为一个python字典,在之后想调用 ...

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

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

  3. TypeError: 'dict' object is not callabled

    Traceback (most recent call last): File "/root/Desktop/JuniperBackdoor-master/censys.py", ...

  4. 解决Flask和Django的错误“TypeError: 'bool' object is not callable”

    跟着欢迎进入Flask大型教程项目!的教程学习Flask,到了重构用户模型的时候,运行脚本后报错: TypeError: 'bool' object is not callable 这是用户模型: c ...

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

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

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

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

  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. Python学习笔记1 -- TypeError: 'str' object is not callable

    Traceback (most recent call last): File "myfirstpython.py", line 39, in <module> pri ...

  9. python TypeError: 'int' object is not callable 问题解决

    TypeError: 'int' object is not callable 这个错误的原因很简单 看下面的程序: def loss(a,b): return a-b loss = 0 loss = ...

随机推荐

  1. 需要弥补的那部分SQL

    一.前言 虽然我们大多数人都学习过SQL,但是经常忽略它.总是会自以为学到的已经足够用了,从而导致我们在实际开发的过程中遇到复杂的问题后只能在检索数据后通过传统的代码来完成,但是其中很多的功能利用SQ ...

  2. Eclipse的常用快捷键、旁门左道、系统错误小贴士

    转自:http://usenrong.iteye.com/blog/1113700 eclipse是一个开源产品,目前比较流行和普遍的JAVA IDE(集成开发环境)它使用工程化方式管理.虽然ecli ...

  3. Java中的Set, List, Map漫谈

    在编程语言中,集合是指代表一组对象的对象.Java平台专门有一个集合框架(Collections Framework).集合框架是指表示和操作集合的统一架构,隔离了集合的操作和实现细节. 集合框架中的 ...

  4. redis 内存

    ziplist:http://blog.csdn.net/benbendy1984/article/details/7796956 redis 内部存储结构:http://www.searchtb.c ...

  5. 减小Chrome的内存占用的参数

    步骤: 1.右击chrome浏览器快捷方式 属性  目标 后面添加 --purge-memory-button 2. 按 shift+esc 查看进程

  6. 从range和xrange的性能对比到yield关键字(中)

    上节提出了range和xrange的效率问题,这节我们来探究其中的原因   yield的使用   我们看下面的程序: #coding: utf-8 def test(): print 4 print ...

  7. 从零开始学Bootstrap(3)

    首先让我们回顾一下系列内容. 从零开始学Bootstrap(1)介绍了BootStrap最简单的模板,逐条解释了每行代码的含义. 从零开始学Bootstrap(2)强调了边学边做,通过实际的例子,讲解 ...

  8. jQuery 之父:每天写代码

    去年秋天我的支线代码项目 遇到了一些问题,项目进展不足,而且我没法找到一个完成更多代码的方法(在不影响我在Khan Academy方面的工作的前提下). 我主要在周末进行我的支线,当然有时候也在晚上进 ...

  9. UVa 10387- Billiard

    UVa 10387- Billiard Table of Contents 1 题目 2 思路 3 代码 4 参考 1 题目 ============= Problem A: Billiard In ...

  10. GET请求中URL的最大长度限制总结

    由于jsonp跨域请求只能通过get请求,url长度根据浏览器及服务器的不同而有不同限制. 若要支持IE的话,最大的长度为2083字符,若是中文字符的话只有2083/9=231个字符. 若是Chrom ...