Flask app on pythonanywhere, python JSON decode error

℡╲_俬逩灬. 提交于 2019-12-24 08:47:24

问题


I'm trying to replicate my app the runs on localhost, but on pythonanywhere.

I have a very basic API that provides a JSON response and it all works as expected on localhost:5000.

Moving the code to pythonanywhere, i get a 500 Internal Server Error

The route is:

@app.route('/api/get_authors', methods = ['GET'])
def get_authors():
    authors = get_poi_authors()
    return jsonify(authors)

And the problem seems to come from a line in my getPoiAuthors code:

poiData = json.loads(getResult)['pois']

This works as expected on my machine, but not on pythonanywhere. I get a 'No JSON object could be decoded' Error. Could it problems with python versions? I run 2.7.6.

来源:https://stackoverflow.com/questions/25464539/flask-app-on-pythonanywhere-python-json-decode-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!