0
votes

I have a python GAE application, with an ndb datastore storing images as a blob property. I use get_serving_url() function to serve images, and it works properly on the Google App Engine production server ("my-app".appspot.com).

When i try it on localhost, the URL seems to be generated correctly, but if I click on it I receive a blank page.

Is it normal, because GAE does not implement it on localhost, or it's a problem of my development environment? Anyway: is there a way to make it works on localhost? I didn't find any information on the web.

Thank you.

update

Some additional details: all the upload process work correctly, I see the uploaded image in the blobstore viewer, and its url is something like localhost:8000/*blob-key*?display=inline.

When i call get_serving_url() on localhost, i obtain an url like localhost:8080/_ah/img/*blob-key* and it does not work (blank page). I just discovered that on Log Console I receive this message:

ERROR 2013-12-30 11:52:14,299 module.py:665] Request to '/_ah/img/vMDNz9x9ak9VcjBXmfMBcg==' failed

Traceback (most recent call last): File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\devappserver2\module.py", line 661, in _handle_request return handler.handle(match, environ, wrapped_start_response) File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\devappserver2\wsgi_handler.py", line 59, in handle return self._wsgi_app(environ, start_response) File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\devappserver2\blob_image.py", line 195, in call return self.serve_image(environ, start_response) File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\devappserver2\blob_image.py", line 184, in serve_image image, mime_type = self._transform_image(blobkey, options) File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\devappserver2\blob_image.py", line 68, in _transform_image image = _get_images_stub()._OpenImageData(image_data)

AttributeError: 'ImagesNotImplementedServiceStub' object has no attribute '_OpenImageData'

Anyway, when i deploy on the production server, the get_serving_url() produce something like lh6.ggpht.com/*longer-blob-key* that points on Google servers and works correctly.

2
Should be working fine. Check an example of a boilerplate here: github.com/jimmykane/gae-image-upload-exampleJimmy Kane
I suggest you to use the blobstore to upload and store images, as getServingUrl() takes blobkey which is returned when you upload to blobstore. Once you upload to blobstore your problem will be solved.Ankur Jain
boilerplate example is similar to my code. I tryied on my pc and had the same result: blob uploaded correctly, (i see it on SDK console) but the serving urls points to a blank page.Domenico

2 Answers

0
votes

You need to install PIL to make it working on your local machine. Install PIL from https://developers.google.com/appengine/docs/python/images/installingPIL

0
votes

I solved the issue updating Google App Engine. Now I have the release 1.9.15 and don't have the problem anymore.