Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

local GAE datastore does not keep data after computer shuts down

On my local machine (i.e. http://localhost:8080/), I have entered data into my GAE datastore for some entity called Article. After turning off my computer and then restarting next day, I find the datastore empty: no entity. Is there a way to prevent this in the future?

How do I make a copy of the data in my local datastore? Also, will I be able to upload said data later into both localhost and production?

My model is ndb.

I am using Max OS X and Python 2.7, if theses matter.

like image 374
kasavbere Avatar asked Dec 26 '22 13:12

kasavbere


1 Answers

I have experienced the same problem. Declaring the datastore path when running dev_appserver.py should fix it. These are the arguments I use when starting the dev_appserver

python dev_appserver.py --high_replication --use_sqlite --datastore_path=myapp.datastore --blobstore_path=myapp_blobs

This will use sqlite and save the data in the file myapp.datastore. If you want to save it in a different directory, use --datastore_path=/path/to/myapp/myapp.datastore

I also use --blobstore_path to save my blobs in a specific directory. I have found that it is more reliable to declare which directory to save my blobs. Again, that is --blobstore_path=/path/to/myapp/blobs or whatever you would like.

Since declaring blob and datastore paths, I haven't lost any data locally. More info can be found in the App Engine documentation here:

https://developers.google.com/appengine/docs/python/tools/devserver#Using_the_Datastore

like image 54
Aaron Hampton Avatar answered May 20 '23 23:05

Aaron Hampton