attribute error :‘request’objecthasnoattribute‘is _ xhr’解决方法1)查看jsonify原函数
EFJsonify(*Args, * kwargs (3360 (' ' this function ' sresponsewillbeprettyprintedifitwasnotrequestedwith ` x-requested-with 3360 xmlhtted tosted JSON ify _ pretty print _ regular ` ` configparameterissettofalse . version added 33603360.2 ' ' indent=noneifcurrent _ app and not request.is _ xhr : indent=2return current _ app.response _ class (dumps (dict ) args,**kwargs ),索引
2) 解决如下:
在flask配置式中设置:
从JSON ify _ pretty print _ regular=false返回的中文编码不是解决方案。 在flask配置文件中设置。
JSON_AS_ASCII=False #启用中文flask的jsonify序列化dict的结果将自动按照key的下标按升序排序。 想要直接返回dict的解决方案:在flask配置文件中放置:
JSON_SORT_KEYS=False #不使用jsonify的默认排序功能