All the demos and guides shows how to access cloud datastore from python on GCE or from local machine, but is it possible to access cloud datastore from python hosted on a GAE ?
from gcloud import datastore
import os
import webapp2
# dataset = datastore.get_dataset(
# 'appid',
# 'xxx@developer.gserviceaccount.com',
# os.path.abspath("appid.p12"))
#
# entity = dataset.entity('People')
# entity['name'] = 'helloworld'
# entity['age'] = 25
# entity.save()
# print 'Hello, world!'
class MainPage(webapp2.RequestHandler):
def get(self):
dataset = datastore.get_dataset(
'appid',
'xxxx@developer.gserviceaccount.com',
os.path.abspath("appid.p12"))
entity = dataset.entity('People')
entity['name'] = 'helloworld'
entity['age'] = 25
entity.save()
self.response.out.write('Hello')
application = webapp2.WSGIApplication([
('/', MainPage)
], debug=True)
I don't seem to get this working. like https://cloud.google.com/appengine/docs/python/gettingstartedpython27/helloworld
If anyone has this working on appengine please share. Thanks