Tuesday, September 30, 2008

Little secret: dev_appserver is_required



If you do skip around and rearrange the steps of the tutorials for Google App Engine, one thing you may try to do, is continually, incrementally, directly upload to Google, using appcfg.py update ...

Unfortunately, this won't work. If you use GQL and the Datastore API, you'll find that you need to run the local development server dev_appserver.py before deploying ... the dev server creates an index.yaml file, essentially mapping your db model and its use to Big Table. This gets deployed with your application. So, skipping this step (at least for most applications, which use the db) is not an option.

If you don't run the local dev_appserver, you'll get error messages from Google's servers when you run your webapp, like this:

Traceback (most recent call last):
File "/base/python_lib/versions/1/google/appengine/ext/webapp/__init__.py", line 499, in __call__
handler.get(*groups)
File "/base/data/home/apps/2splice/1.31/main.py", line 20, in get
for greeting in greetings:
File "/base/python_lib/versions/1/google/appengine/ext/db/__init__.py", line 1257, in __iter__
return self.run()
File "/base/python_lib/versions/1/google/appengine/ext/db/__init__.py", line 1589, in run
query_run = self._proto_query.Run(*self._args, **self._kwds)
File "/base/python_lib/versions/1/google/appengine/ext/gql/__init__.py", line 581, in Run
res = bind_results.Get(self.__limit, offset)
File "/base/python_lib/versions/1/google/appengine/api/datastore.py", line 938, in Get
return self._Run(limit, offset)._Next(limit)
File "/base/python_lib/versions/1/google/appengine/api/datastore.py", line 887, in _Run
str(exc) + '\nThis query needs this index:\n' + yaml)
NeedIndexError: no matching index found.
This query needs this index:
- kind: Greeting
properties:
- name: date
direction: desc

No comments: