views:

192

answers:

1

I'm new to both Django and Google App Engine, and am using a sandbox in OSX10.6 with the GoogleAppEngineLauncher. I've got a basic "bookstore" application running from the tutorial in the OReilly "Programming Google App Engine" book.

Here's the bug: If I add a new object to the datastore through the web interface, then it's readable through the web interface, but does not appear to exist if I query the datastore through the shell. Vice versa: If I add an object in the shell, then I can read it from the shell, but it doesn't appear in the web interface.

A related curio: All data vanishes from both datastores when I reboot my computer.

Any thoughts or theories would be welcome. Thanks!

=T=

A: 

If you use the remote API shell and point it at the instance you're running on your machine, you should get the same datastore. It's unclear how you're accessing your app via "the shell", but it seems that you're creating a second instance to do so.

The data vanishes from the datastore when you reboot your machine because by default the datastore file is created in /tmp; you can specify another location (one that the system doesn't clean for you on reboot) for it when you run dev_appserver.py.

Wooble
i'm accessing the shell by running "python manage.py shell" in my app's home dir
tones
How are you running the server? I believe "python manage.py runserver" should get you the same datastore as using manage.py shell, whereas running dev_appserver.py manually will get you a different datastore. This may also depend on any helpers/patches you're using, however.
Wooble
I've been running the server via the GoogleAppEngineLauncher app. I'll try running it from command line instead and making sure both it and my shell are pointing at the same datastore.
tones
How do I create a new datastore? When I point dev_appserver at an empty file or directory, it throws errors.
tones
I was able to hack this by copying the datastore from /tmp into another directory and then specifying the new location when I run appserver or shell. That seems to have solved the problem!
tones
Actually google-app-engine-django's manage.py doesn't have a flag I can see to allow to specify an alternate datastore path...
tones
Looks like this is an outstanding feature request for the gae django helper: http://code.google.com/p/google-app-engine-django/issues/detail?id=103
tones