1

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 Answers2

2

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

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.

Alex
  • 5,141
  • 12
  • 26
  • Thank you for your answer. I tried to do with a command line like: dev_appserver.py app.yaml --support_datastore_emulator=true --dev_appserver_log_level=debug --datastore_emulator_port=8081 Then they say: "Using Cloud Datastore Emulator.", "Dev App Server is now running.", "export DATASTORE_EMULATOR_HOST=localhost:8081", "Starting module "default" running at: http://localhost:8080", "Starting admin server at: http://localhost:8000" And I can access emulator datastore using port 8081. Btw when I inserted some data into emulator datastore, I can't find data in localhost:8000/datastore. – crazy-coding Nov 24 '19 at 01:41