Can't deploy my app to Google App Engine

2019-07-31 18:16发布

how am I supposed to import json on Google App Engine? My project works fine locally, but I just can't deploy it online. Here is my code:

import json
self.response.out.write(json.dumps(Jsonobject))

and this is the snippet from the log:

<type 'exceptions.ImportError'>: No module named json
Traceback (most recent call last):
File "/base/data/home/apps/clinteney/1.349424641588618637/Main.py", line 4, in <module>
import json

Thank you in advance.

2条回答
老娘就宠你
2楼-- · 2019-07-31 18:30

Brian M. Hunt says:

from django.utils import simplejson as json
查看更多
smile是对你的礼貌
3楼-- · 2019-07-31 18:38

Try replacing the first line with

import simplejson

Google App Engine only supports certain packages when running on production.

查看更多
登录 后发表回答