Skip to content

Instantly share code, notes, and snippets.

@voscausa
Last active October 15, 2021 14:07
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save voscausa/9541133 to your computer and use it in GitHub Desktop.
Save voscausa/9541133 to your computer and use it in GitHub Desktop.
Use GCS (Google cloudstoarge) to replace the app engine blobstore. You can use the Blobstore service to access GCS.
@bmutinda
Copy link

Great example.
But when i try to run my project i get an exception inside in this line

dyn.serving_url = images.get_serving_url(
blobstore.create_gs_key('/gs' + gcs_file_name), secure_url=True)

I have tried to fix this but it doesn't work. What might be the issue here ??

---- this is the error message ---
The server has either erred or is incapable of performing the requested operation.

Traceback (most recent call last):
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1535, in call
rv = self.handle_exception(request, response, e)
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1529, in call
rv = self.router.dispatch(request, response)
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1278, in default_dispatcher
return route.handler_adapter(request, response)
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1102, in call
return handler.dispatch()
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 572, in dispatch
return self.handle_exception(e, self.app.debug)
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 570, in dispatch
return method(_args, *_kwargs)
File "/base/data/home/apps/skunajamapp/1.374701545509525083/kunajam_uploader.py", line 77, in post
serving_url = gcs_serving_url( entity )
File "/base/data/home/apps/s
kunajamapp/1.374701545509525083/kunajam_uploader.py", line 38, in gcs_serving_url
gcs_dyn.serving_url = images.get_serving_url( blobstore.create_gs_key( '/gs'+gcs_file_name ), secure_url = True )
File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/api/images/init.py", line 1793, in get_serving_url
return rpc.get_result()
File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/api/apiproxy_stub_map.py", line 612, in get_result
return self.get_result_hook(self)
File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/api/images/__init
.py", line 1891, in get_serving_url_hook
raise _ToImagesError(e, readable_blob_key)
ObjectNotFoundError

@voscausa
Copy link
Author

Are you sure the image is in the bucket?

@rlarge
Copy link

rlarge commented Sep 4, 2014

i got a question, i'm using flow.js and ng-flow for angluar js and running into the same file name problem... have you ran into that and if how did you deal with it...

@voscausa
Copy link
Author

I have revised the code. The updated version can be found here: https://github.com/voscausa/appengine-gcs-blobstore-python

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment