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. 设计模式之美:Structural Patterns(结构型模式)

    结构型模式涉及到如何组合类和对象以获得更大的结构. 结构型类模式采用继承机制来组合接口实现. 结构型对象模式不是对接口和实现进行组合,而是描述了如何对一些对象进行组合,从而实现新功能的一些方法. 因为 ...

  2. Nginx学习笔记(三) Nginx基本数据结构

    Nginx基本数据结构 话说学习一种编程语言,例如C语言,我们首先学的也是数据结构,这是以后开发程序的关键.为了更好更方便的开发Nginx,Nginx自己实现了很多适合nginx的数据结构. Ngin ...

  3. 由Java中toString()方法引发的无意识的递归想到的

    先看一段很简单的java代码: toString()/** * @author jeffwong */ public class InfiniteRecursion { public String t ...

  4. git查看一个文件的历史记录

    git log --all -- '*'FILENAME'*' 支持模糊查询 主要用于查找历史上被删除的文件 可以做成git的一个快捷命令 find = "!f(){ git log --a ...

  5. LInux iptables学习

    作者原文 : http://blog.chinaunix.net/uid-9950859-id-98277.html       要在网上传输的数据会被分成许多小的数据包,我们一旦接通了网络,会有很多 ...

  6. Atitit.并发测试解决方案(2) -----获取随机数据库记录 随机抽取数据 随机排序 原理and实现

    Atitit.并发测试解决方案(2) -----获取随机数据库记录 随机抽取数据 随机排序 1. 应用场景 1 2. 随机抽取数据原理 1 3. 常用的实现方法:::数据库随机函数 1 4. Mssq ...

  7. paip.提升安全性----Des加密 java php python的实现总结

    paip.提升安全性----Des加密 java php python的实现总结 ///////////    uapi         private static String decryptBy ...

  8. ecshop2.72文件结构说明

    ECShop 2.7.2 的结构图及各文件相应功能介绍 ECShop 2.7.2 upload 的目录┣ activity.php 活动列表┣ affiche.php 广告处理文件┣ affiliat ...

  9. Liferay7 BPM门户开发之30: 通用帮助类Validator、ArrayUtil、StringUtil等使用

    废话不多说,直接上代码. 验证类Validator 主要是空验证.数字.格式验证 调用的例子: protected void validateEmailFrom(ActionRequest actio ...

  10. MFC可编辑ListBox控件CEditableListBox

    左击选中单元格,右击进入编辑状态. MFC自定义控件的添加方法C#自定义控件编译后就自动出现在工具箱里.MFC的自定义控件需要先拖个基类到对话框上,然后添加一个控件变量.再修改源代码中的控件名为扩展控 ...