Why can't I see any data in the Google App Engine *Development* Console?
I run my google app engine application in one of two ways...
- Directly by using the application from http://localhost:8080
- Or execute unit tes开发者_开发知识库ts from http://localhost:8080/test
When I create entities by using the application directly, the data is visible in the Development Console (dataStore view).
However, when I execute the unit tests... even if they succeed and I can put() and get() data, the data does not show in the dataStore view. Any idea why I can't see my data? Even though it is there?
Notes:
- I use GAEUnit for unit tests.
- the data stored mostly consists of StringProperties().
- I use Python and run Django on top of the GAE, don't know if that matters.
Is there a chance your Dev Console DataStore view is looking at a different datastore than your django app is writing to? I had a similar issue with my Django/GAE setup and resolved it by explicitly saying the location of my datastore when starting up the dev server. To start the dev server this way, just go into the directory of your django project and type:
dev_appserver.py --datastore_path=/path/to/datastore/my_datastore --history_path=/path/to/datastore/my_datastore
GAEUnit creates its own proxy stub datastore, using this code on line 357 of the current '2.0a for django' release:
temp_stub = datastore_file_stub.DatastoreFileStub(
'GAEUnitDataStore', None, None, trusted=True)
This proxy datastore is only held in memory, so is deleted once the tests finish running. It is also empty when the tests start running, ie it does not contain any data currently in the default development datastore.
You can temporarily modify this to make it write to a file on your development system, eg:
temp_stub = datastore_file_stub.DatastoreFileStub(
'GAEUnitDataStore', '/path/to/gaeunit.datastore', None, trusted=True)
Then run dev_appserver.py on a different port, eg:
dev_appserver.py --port=8081 --datastore_path=/path/to/gaeunit.datastore /path/to/application/
And then finally, open http://localhost:8081/_ah/admin
in a browser to view the contents of the temporary datastore.
精彩评论