How do I make App Engine SDK available in Python?

0 views
Skip to first unread message

edmund_spenser via StackOverflow

unread,
Nov 18, 2014, 12:20:20 AM11/18/14
to google-appengin...@googlegroups.com

I want google.appengine.ext.blobstore and google.appengine.api.images to work outside of App Engine. Do these modules require App Engine in order to work? I want to create public but not guessable URLs of my images on Google Cloud Storage and serve them via Django.

I read that this is done with google.appengine.ext.blobstore.create_gs_key() and google.appengine.api.images.get_serving_url(). This is what I have so far:

import boto
import gcs_oauth2_boto_plugin
from google.appengine.api import images
from google.appengine.ext import blobstore

bucketname = 'mybucket'

gcs_object_name = '/gs/mybucket/vincent-van-gogh/the-starry-night.jpg'
blob_key = blobstore.create_gs_key(gcs_object_name)
image_url = images.get_serving_url(blob_key)

And image_url is supposed to be a public but not guessable URL of my image. If I run this code, the error is

AssertionError: No api proxy found for service "blobstore"

This suggests blobstore needs a proxy, aka App Engine, in order to work its magic. Can App Engine modules work outside of App Engine? The docs say the above is a powerful way to serve images because the appengine.api.images module can dynamically resize an image before it's served and the blobstore.create_gs_key() will assign a key to each image in my Cloud Storage bucket so that URLs can be generated.

Is there perhaps a better way to serve GCS images with Django?



Please DO NOT REPLY directly to this email but go to StackOverflow:
http://stackoverflow.com/questions/26987062/how-do-i-make-app-engine-sdk-available-in-python

edmund_spenser via StackOverflow

unread,
Nov 18, 2014, 12:25:24 AM11/18/14
to google-appengin...@googlegroups.com

I want google.appengine.ext.blobstore and google.appengine.api.images to work outside of App Engine. Do these modules require App Engine in order to work? I want to create public but not guessable URLs of my images on Google Cloud Storage and serve them via Django.

I read that this is done with google.appengine.ext.blobstore.create_gs_key() and google.appengine.api.images.get_serving_url(). This is what I have so far:

import boto
import gcs_oauth2_boto_plugin
from google.appengine.api import images
from google.appengine.ext import blobstore

bucketname = 'mybucket'

gcs_object_name = '/gs/mybucket/vincent-van-gogh/the-starry-night.jpg'
blob_key = blobstore.create_gs_key(gcs_object_name)
image_url = images.get_serving_url(blob_key)

And image_url is supposed to be a public but not guessable URL of my image. If I run this code, the error is

AssertionError: No api proxy found for service "blobstore"

This suggests blobstore needs a proxy, aka App Engine, in order to work its magic. Can App Engine modules work outside of App Engine? The docs say the above is a powerful way to serve images because I can generate a URL for each image and also resize the image dynamically.

Will this strategy work or is there a better way to serve images from Google Cloud Storage with Django?

Reply all
Reply to author
Forward
0 new messages