1
votes

I installed all env for google cloud app engine development server and datastore emulator. And I run the datastore emulator first.

gcloud beta emulators datastore start

and start dev-appengine server.

dev_appserver.py app.yaml


How can I check devappserver works with the datastore emulator?

datastore env is DATASTORE_EMULATOR_HOST_PATH=localhost:8081/datastore localhost:8000/datastore works normally, but localhost:8081/datastore doesn't work.

2

2 Answers

2
votes

Issue solved.

Emulator Project Name on the part of using datastore client towards emulator:8081 and the dev_appserver application name were different.

I wrote "application: my-project-id" in app.yaml file for dev_appserver application name.

"set DATASTORE_PROJECT_ID=my-project-id" for dev_appserver application name (GCP Datastore Emulator)

Run dev_appserver

dev_appserver.py app.yaml --support_datastore_emulator=true --datastore_emulator_port=8081

1
votes

Have you tried setting --datastore_emulator_port when running dev_appserver.py to the port where your datastore emulator is running?

https://cloud.google.com/appengine/docs/standard/python/tools/migrate-cloud-datastore-emulator#using_dev_appserver_with_the_datastore_emulator

EDIT: Also, it looks like dev_appserver.py is supposed to print the following line if it is using the Cloud Datastore Emulator

... Using Cloud Datastore Emulator.