How can check running dev_appserver.py with datastore-emulator

441 views Asked by At

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

There are 2 answers

0
crazy-coding On BEST ANSWER

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
Alex On

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.