python Flask :TypeError: 'dict' object is not callable

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 的错误

你可能感兴趣的:(callable)