如何在 Google App Engine 中加载 Blobproperty 图像?
我写了一些代码。
我可以将图像保存在 BobProperty 中。
但我无法将图像加载到 HTML 页面中...
源代码:
class Product(db.Model):
image = db.BlobProperty()
...
class add:
productImage = self.request.get('image')
product.image = db.Blob(productImage)
product.put()
但我将 {{product.image}} 写入 html 代码。但也有像��袀 ���� ���� ���� (����������� ��(:(�������� (������ (��>̢��� (�������>������Y������K��
如果我想从数据存储加载图像,我该怎么办?
I wrote some codes.
I could save image in BobProperty.
But I cannot load image into HTML page...
source code:
class Product(db.Model):
image = db.BlobProperty()
...
class add:
productImage = self.request.get('image')
product.image = db.Blob(productImage)
product.put()
but i wrote {{product.image}} into html code. But there were like ��袀 ���� ���� ���� (����������� ��(:(������� (������� (��>̢��� (�������>������Y������K��
What should i do if i want load image from datastore?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我使用辅助视图:
并在模型中:
并仅使用
{{ model.get_image_path }}
代替。(这是 django-nonrel,但我想您可以弄清楚它的作用)
另外,还有一篇文章 这里 关于这一点;你应该检查一下。
I use an auxiliary view:
and in the model:
and just use
{{ model.get_image_path }}
instead.(this is django-nonrel, but I guess you could figure out what it does)
Also, there is a post here about this; you should check it out.