Python 为什么我的形象没有出现?
嗨,我想知道为什么我的图像没有出现。我认为它既存储为blobproperty,也存储在blobstore中,因为它在列表页面上显示为缩略图。未显示图像的页面的地址为 同一图像的缩略图将显示在列表中 用于显示图像的部分模板代码为:Python 为什么我的形象没有出现?,python,google-app-engine,Python,Google App Engine,嗨,我想知道为什么我的图像没有出现。我认为它既存储为blobproperty,也存储在blobstore中,因为它在列表页面上显示为缩略图。未显示图像的页面的地址为 同一图像的缩略图将显示在列表中 用于显示图像的部分模板代码为: {% if ad.matched_images.get %} <table><tr> <td> <div class="ad_pict" id="display_image">&l
{% if ad.matched_images.get %} <table><tr>
<td>
<div class="ad_pict" id="display_image"><img src="{{url}}" alt="" onload="show_hidden_elements();return false;"></div>
</td> <td>
{% ifequal len 1 %}
{% else %}
{% for im in imv %}
<div id="thumb0" class="ad_thumb ad_border_solid_black" onclick="showLargeImage('{{im}}');thumbnailBorder(this, 5 )">
<table class="clean_table shadowed_thumb" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td><img src="/_/img/thumb_left_top.gif"></td>
<td class="top_middle" align="left" valign="bottom"></td>
<td></td>
</tr>
<tr>
<td class="middle_left"></td>
<td><img src="{{im}}=s120" alt="">
</td>
<td class="single_middle_right" valign="top"><img src="/_/img/thumb_single_right_top.gif"></td>
</tr>
<tr>
<td></td>
<td class="single_bottom_center" valign="top"><img src="/_/img/thumb_single_left_bottom.gif"></td>
<td valign="top"><img src="/_/img/thumb_single_right_bottom.gif"></td>
</tr>
</tbody>
</table>
</div>
{% endfor %}
{% endifequal %}
如果我使用的是页面的旧版本,那么图像确实会出现,因此很明显我在数据库中有它,我刚刚编写了一个bug,需要构建从blobproperty到blobstore的迁移:
因为图像出现在后面的url上,我知道它就在那里,只是我代码中的一个bug,我无法复制它,所以图像不会出现。感谢您的帮助我猜这两个if语句中有一个是错误的:
if image:
if image.primary_image:
url = images.get_serving_url(str(image.primary_image.key()))
如果您实际调用的是get_serving_url,那么您将获得一个有效的服务url或一个异常。相反,url仍然有它的起始值,一个空白字符串。谢谢!你完全正确。有时计算结果为false的是image.primary_图像。我不知道为什么,但至少现在我设法解决了添加子句
else:
if image:
if image.primary_image:
url = images.get_serving_url(str(image.primary_image.key()))