Skip to content

Cloud datastore access to appengine python with out Managed vm or Compute engine. #405

@sasivarunan

Description

@sasivarunan

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',
#     '[email protected]',
#     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',
            '[email protected]',
            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

Metadata

Metadata

Assignees

Labels

🚨This issue needs some love.api: datastoreIssues related to the Datastore API.triage meI really want to be triaged.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions