I have created the class Blog
in model.py and in that it has an attribute photo
which is a BlobkeyProperty
.
My problem is how to diplay that photo on html page.. all I am getting is just key.I do not know much of Jinja and python so please help.. :)
{% if blog.photo == None %}
<img src="static/css/img/photo.jpg" /><br/>
{% elif blog.photo %}
<span>{{blog.photo.key.get()}}</span><br/>
{% endif %}
the first part is working but the else part is now giving me
Internal Server Error(UndefinedError: 'google.appengine.api.datastore_types.BlobKey object' has no attribute 'key')
If I remove the key.get()
part then it is giving me the blobkey
of that photo
plese help..
This is what I do for handling images from blobstore.
1 Handler for serving images:
Having this handler, then in Jinja/HTML side I just call the routing URL for download handler with the ID parameter, i.e.:
Given route:
JINJA/HTML uses:
1 Handler for uploading images: