I have a new Python 3 / Flask app for the GAE App Engine Standard Environment. It works fine in the local test env and also when deployed to the cloud. As long as I do not use Datastore.
My first attempt for local test failed at line
datastore_client = datastore.Client()
when the following was written to the terminal console upon startup of
dev_server.py:
"google.auth.exceptions.DefaultCredentialsError: Could not automatically determine credentials. Please set GOOGLE_APPLICATION_CREDENTIALS or explicitly create credentials and re-run the application."
The datastore emulator is running locally on localhost:8081.
These are set:
export DATASTORE_DATASET=xxxxxx
export DATASTORE_EMULATOR_HOST=localhost:8081
export DATASTORE_EMULATOR_HOST_PATH=localhost:8081/datastore
export DATASTORE_HOST=http://localhost:8081
export DATASTORE_PROJECT_ID=xxxxxx
What am I missing? What kind of credentials do I need for a local (my laptop) datastore emulator and how do I set them?
You need to set GOOGLE_APPLICATION_CREDENTIALS
per:
https://cloud.google.com/docs/authentication/getting-started