背景
有一个 Flask 项目,然后有一个路由返回的是 dict
![](https://img-blog.csdnimg.cn/img_convert/a7621a49cf5bf1a61901df78bb01405a.png)
![](https://img-blog.csdnimg.cn/img_convert/bfa708b7c1bb6d0d19f1b2126eaa3b07.png)
通过浏览器访问,结果报错
![](https://img-blog.csdnimg.cn/img_convert/0d44f75efcdebf15a2dede7e7597611a.png)
关键报错信息
TypeError: 'dict' object is not callable
The view function did not return a valid response. The return type must be a string, tuple, Response instance, or WSGI callable, but it was a dict.
意思是不能返回 dict
解决方案
结果是版本太老了,用的 Flask 1.0.2....我服了,之前跑别人的项目装了个老版 Flask,装个最新版本就好了...