Reputation: 279
I have a datastore storing images as a blob property. I want to use get_serving_url to serve images on the fly.
def urlserve(self):
return images.get_serving_url(str(self.key.urlsafe()),350)
It gives me a URL like
http://localhost:8097/_ah/img/ahBkZXZ-cmFqaW5pbmF0aW9uciYLEglpbWFnZWxpc3QiDWRlZmF1bHRfaW1hZ2UMCxIDSW1nGKkHDA=s350
But I can't able to serve using that page.
So I could only use blobstore image to do this, if so do i need to create a blobstore for my image and store the blobreferenceproperty in my datastore? Or is there better way?
Upvotes: 0
Views: 653
Reputation: 21835
If you are using db
then you should store the blob_info.key()
in the blobstore.BlobReferenceProperty
, otherwise if you're using the ndb
then you should store the key
in the ndb.BlobKeyProperty
.
For the image serving URL you don't have to calculate it all the time, but you could simply store the value of it to your Model at the same time that you are storing the BlobKey
.
Upvotes: 1