[SOLVED] Python3 dev_appserver and datastore


This Content is from Stack Overflow. Question asked by Bruno Ripa

I am creating a small Python 3 app for appengine, and I’d expect this to use the local datastore (which to the best of my understanding is a .db file).

I am starting the app using dev_appserver.py ., as per docs I have exposed a service account using GOOGLE_APPLICATION_CREDENTIALS env var (ages ago, when Python2 was the only supported runtime, this was not needed), and I still have a 403 permission error if I try to create any entity in the datastore.

Isn’t this supposed to use local datastore ?

Should I use the datastore emulator ?

Is the use of dev_appserver.py still needed, or I can just start the app using a proper python ... command ?

Thanks, it’s more than 10 years I am out of appengine, and it’s just for a local test I am doing.

P.s.: I am using google.cloud.ndb to access the datastore.


I have had this same experience. It seems gcloud CLI is trying to ensure that the project (your local project) exists in Google Cloud and the service account specified has access to it (this was a different behavior from Python 2).

A work around is – according to Google, you can run your Python App using the development tools that you usually use e.g. python xyz, flask run abc etc. If you do it this way, it’s best to use datastore emulator. The downside with this approach is that you lose access to a GUI for viewing your data.

This Question was asked in StackOverflow by Bruno Ripa and Answered by NoCommandLine It is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?