app engine datastore auto-clears every time projec

2019-01-20 16:44发布

问题:

Every time I run my project (eith dev_appserver.py myapp or manage.py runserver in django), the datastore will be cleared. I have persisted the data by model.put() or model.save() in django. In the current session, I can see the data in the admin page, but next time I run the project, all previous datastore is lost.

I know app engine has the --clear_datastore run condition, but i dont't want this feature.

By the way, where is there a local datastore file?

回答1:

you can use the --datastore_path=/datastore/path/dev_appserver.datastore parameter with dev_appserver.py

--blobstore_path=/path/to/blobstore/folder is an option too.



回答2:

in fact the --datastore_path= is not the best flag to use because it only sets part of the storage options The best IMHO is:

--storage_path=...

Path at which all local files (such as the Datastore, Blobstore files, Google Cloud Storage Files, logs, etc) will be stored, unless overridden by --datastore_path, --blobstore_path, --logs_path, etc.

found at https://developers.google.com/appengine/docs/python/tools/devserver?csw=1