[英]show images on the templates of django using google app engine
i am using google app engine with django to make a small application that it has these features我正在使用带有 django 的谷歌应用程序引擎来制作一个具有这些功能的小型应用程序
well after finishing part 1, now i am somewhere stuck in part 2 where i need to show images.在完成第 1 部分之后,现在我被困在第 2 部分的某个地方,我需要显示图像。
i did everything i retrieved the image keys, but the images are not showing.我做了所有我检索图像密钥的事情,但图像没有显示。
only the titles of the images i saved in the datastore.只有我保存在数据存储中的图像的标题。
here is my code:这是我的代码:
<ul>
{% for image in image.all %}
<li>{{ image.title }} </li>
<li> <img src="/pictures/models.{{image.key}}"/> </li>
{% endfor %}
</ul>
Assuming假设
/pictures/models\.(.*)/
/pictures/models\.(.*)/
Then you'd do something like然后你会做类似的事情
class BlobstoreImageHandler(blobstore.handler.BlobstoreDownloadHandler):
def get(self, resource):
resourse = str(urllib.unquote(resource))
blob_info = blobstore.BlobInfo.get(resource)
self.send_blob(blob_info)
which is straight out of http://code.google.com/appengine/docs/python/blobstore/overview.html#Serving_a_Blob直接来自http://code.google.com/appengine/docs/python/blobstore/overview.html#Serving_a_Blob
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.