Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/google-app-engine/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google app engine Can';t获取谷歌应用程序引擎图像API获取服务url函数工作_Google App Engine_Python 3.x_Python Imaging Library - Fatal编程技术网

Google app engine Can';t获取谷歌应用程序引擎图像API获取服务url函数工作

Google app engine Can';t获取谷歌应用程序引擎图像API获取服务url函数工作,google-app-engine,python-3.x,python-imaging-library,Google App Engine,Python 3.x,Python Imaging Library,我是谷歌应用引擎和Python的新手。我几乎完成了一个项目,但无法让get\u service\u url()函数工作。根据文档,我已经将所有内容剥离到最基本的功能。但我仍然从服务器上收到500个错误。有什么想法吗?代码如下: from google.appengine.api import images .... class Team(db.Model): avatar = db.BlobProperty() .... def to_dict(self):

我是谷歌应用引擎和Python的新手。我几乎完成了一个项目,但无法让get\u service\u url()函数工作。根据文档,我已经将所有内容剥离到最基本的功能。但我仍然从服务器上收到500个错误。有什么想法吗?代码如下:

from google.appengine.api import images

....

class Team(db.Model):
    avatar = db.BlobProperty()

    ....

    def to_dict(self):
        ....
        image_url = images.get_serving_url(self.avatar.key())
最后一行是问题所在…注释它可以让应用程序正常运行。但它几乎是直接从文档中复制的。我应该注意,我可以通过以下方式直接下载化身blob:

class GetTeamAvatar(webapp2.RequestHandler):
def post(self):
    team_id = self.request.get('team_id')
    team = Team.get_by_id(long(team_id))
    self.response.write(team.avatar)

所以我知道它存储正确。我的机器上没有PIL…这就是问题所在吗?数据存储的图像API说它在本地有PIL,所以如果我部署我的应用程序,这不重要,对吗?我有Python3.3,显然PIL在2.6停止运行。

PythonAppEngine运行时间是2.7(OK和2.5),所以不要尝试使用3.x

其次,get_serving_URL是使用BlobStore实体键而不是BlobProperty调用的方法

你在这里混淆了两件不同的事情


我会首先集中精力让你的代码在2.7下本地正确运行,2.7版也可以使用PIL。

如果你试图部署你的应用程序而不在本地进行测试,我会印象深刻

您需要做的一件事是通过libraries属性在app.yaml中提供PIL