Google App Engine local datastore path configuration
Sorry for asking the nth permutation of this question, but i'm stymied.
I'm running GAE for python2.5 on OS X, and i'm losing all data betwe开发者_Go百科en reboots. From what I understand from related SO posts, the default location for local datastore file is wiped with each reboot. I have tried changing the location to a central /datastores directory with:
dev_appserver.py --datastore_path=/Users/Me/gae_apps/datastores /Users/Me/gae_apps/app_1
which doesn't generate an error, but when i fire up dev_appserver.py after rebooting, I see this output, and the data is again wiped:
WARNING 2011-07-14 17:50:56,297 urlfetch_stub.py:108] No ssl package found. urlfetch will not be able to validate SSL certificates.
INFO 2011-07-14 17:50:57,653 appengine_rpc.py:159] Server: appengine.google.com
INFO 2011-07-14 17:50:57,722 appcfg.py:453] Checking for updates to the SDK.
INFO 2011-07-14 17:50:58,448 appcfg.py:470] The SDK is up to date.
WARNING 2011-07-14 17:50:58,448 datastore_file_stub.py:511] Could not read datastore data from /var/folders/ps/psEgjl3fF+C5hecCKN2AW++++TI/-Tmp-/dev_appserver.datastore
INFO 2011-07-14 17:50:58,486 rdbms_sqlite.py:58] Connecting to SQLite database '' with file '/var/folders/ps/psEgjl3fF+C5hecCKN2AW++++TI/-Tmp-/dev_appserver.rdbms'
WARNING 2011-07-14 17:50:58,521 dev_appserver.py:4700] Could not initialize images API; you are likely missing the Python "PIL" module. ImportError: No module named _imaging
INFO 2011-07-14 17:50:58,689 dev_appserver_multiprocess.py:637] Running application portfolio on port 8080: http://localhost:8080
I should mention that i have several apps, all of which sit in separate directories under /Users/Me/gae_apps/
Not sure if this is related to the failure to read dev_appserver.datastore and subsequent switch to SQLite or not.
Any help would be greatly appreciated. thanks!
Doing this "*--blobstore_path=/Users/me/Documents/workspace/app-name/ --datastore_path=/Users/me/Documents/workspace/app-name/datastore.rbm*", is working for me, on OS X.
I had this problem in Linux for one of the versions of GAE. What I did then was run dev_appserver.py without specifying datastore_path. I then locate dev_appserver.datastore and/or dev_appserver.rdbms (I forget which now) which was in /tmp in Linux. I then copied both these files to my ~/gae/datastore/.
After that when I ran dev_appserver.py with --datastore_path it worked without any issues.
Not sure if it will work on OS X but its worth a shot.
Possibly a sledgehammer to crack a nut here but if the patches are no help you can script the AppEngine and force it to use a different path on startup.
Have you tried inserting any data in the datastore after starting up the server with the new datastore location? When I don't insert any new data, I get the error you mention: Could not read datastore data from ...
.
However, when I start up my app, register, and then restart the app, I get no errors, and the new datastore location is used.
Maybe I'm misreading your question and you are inserting data after the restart. In that case, I can't reproduce your issue.
I have been struggling with this issue for a very long time. This finally worked, thanks to the answer by said-omar.
Simply add this as your flag: --datastore_path=/Users/me/Documents/workspace/app-name/datastore.rbm
..obviously changing everything before "/datastore.rbm" to point to the directory where you want the database stored.
精彩评论