app engine datastore auto-clears every time project runs
Asked Answered
P

2

1

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?

Pardon answered 12/6, 2012 at 14:38 Comment(2)
same here... but not EVERY time. seems like the local_db.bin gets deleted sometimes. Diff is that I am on Java.Lewiss
Make sure you are using the latest SDK, there were some recent issues fixed I believe..Mannerly
A
3

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.

Armilda answered 12/6, 2012 at 15:44 Comment(2)
Note that the default --datastore_path is usually in /tmp on Linux and Mac, so if your machine is set up to clear out /tmp periodically (such as on host startup), that would explain an occasional emptying of the development datastore. As aschimd00 advises, you can set this path to somewhere else that doesn't get deleted.Lavinalavine
thanks. i just found it's the sdk that causes the problem. no more issue under sdk 1.6.6.Pardon
C
1

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

Cashew answered 18/11, 2013 at 16:17 Comment(1)
why the down vote? it's absolutely correct and tested, straight out of the documentation!Cashew

© 2022 - 2024 — McMap. All rights reserved.