Hey Juan,

You're right to point out that our documentation could be better here. 
We're currently working on expanding the documentation on the Datastore 
emulator. Now, as to your main question:

*google-cloud-datastore*

You can use the google-cloud-datastore 
<https://pypi.python.org/pypi/google-cloud-datastore> library to interact 
with the datastore emulator from both standard and flexible environment 
dev_appserver apps. 

*environment variables*

Just be sure to set the environment variables properly by running $(gcloud 
beta emulators datastore env-init). Be sure to run the command exactly like 
that, with the $() included, since this will tell the shell to run the 
commands which are actually output by gcloud beta emulators datastore 
env-init. The commands, which you could also examine and then run yourself, 
one by one, are going to look like this:

export DATASTORE_DATASET=my-project-id
export DATASTORE_EMULATOR_HOST=localhost:8715
export DATASTORE_EMULATOR_HOST_PATH=localhost:8715/datastore
export DATASTORE_HOST=http://localhost:8715
export DATASTORE_PROJECT_ID=my-project-id

*and you're good to go*

When this is done, the python client library linked above will connect to 
the local emulator. See the documentation on the client library (the link 
was above) for the details of coding.

*a small note about the datastore admin viewer in dev*

Currently, the dev_appserver.py admin panel (localhost:8000 usually) 
"datastore" section does not connect properly to the emulator. This is 
documented in this Public Issue Tracker issue I've just filed 
<https://code.google.com/p/googleappengine/issues/detail?id=13589>, and you 
can star that issue to receive updates. I hope this has been helpful to 
you, and feel free to ask any further questions you have. I'll be happy to 
assist.

Cheers,

Nick
Cloud Platform Community Support

On Thursday, February 16, 2017 at 7:59:32 AM UTC-5, Juan Antonio Fernández 
Sánchez wrote:
>
> I'm working in a project that use two apps, one deployed in App Engine 
> standard environment and other in flexible env.
>
>
> One service of the app in the standard env and the app in the flex env. 
> must be access to Google Cloud Datastore 
> <https://cloud.google.com/datastore/docs/concepts/overview>.
>
> If I use in *local* the emulated datastore that run the dev_server in 
> standard environment, the app in the flex env. can't access to this 
> datastore and neither use the ndb ORM library like the service in standard 
> env.
>
>
> So, to have consistency in the way to access to data, I don't what 
> solution would be better to solve this.
>
> I've been thinking if I could use Google Cloud SDK (gcloud tool) to run 
> emulators 
> datastore and access to this using Cloud Datastore Cient Libraries 
> <https://cloud.google.com/datastore/docs/reference/libraries> ( instead 
> of Google Datastore NDB Client Library 
> <https://cloud.google.com/appengine/docs/python/ndb/> ) in both apps (to 
> use exactly the same way to connect) I think that this way is most easy to 
> develop after in cloud platform.
>
>
> I'm finding some problems to connect with this emulated datastore and I 
> would like to know if my approach is good to follow fighting with the 
> problems or change to another way or idea to run my entire project in local.
>
>
> Any help or idea will be welcome.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/f6d1ef7f-5329-41bd-906a-7048b1163e3a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
  • [google-appengine] H... Juan Antonio Fernández Sánchez
    • [google-appengi... 'Nick (Cloud Platform Support)' via Google App Engine

Reply via email to