app engine datastore auto-clears every time projec

2019-01-20 16:54发布

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?

2条回答
放我归山
2楼-- · 2019-01-20 16:56

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.

查看更多
够拽才男人
3楼-- · 2019-01-20 17:00

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

查看更多
登录 后发表回答