Flask app on pythonanywhere, python JSON decode er

2019-08-08 18:51发布

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.

0条回答
登录 后发表回答