app engine NeedIndexError:找不到匹配的索引

时间:2016-05-06 16:57:19

标签: python google-app-engine

尝试部署简单的留言板 https://cloud.google.com/appengine/docs/python/gettingstartedpython27/deploying-the-application

尝试部署应用程序时遇到错误:

appcfg.py --verbose -A glossy-apex-130310 -V v1 update ./
07:56 PM Application: glossy-apex-130310 (was: None); version: v1 (was: None)
07:56 PM Host: appengine.google.com
2016-05-06 19:56:11,019 INFO sdk_update_checker.py:229 Checking for updates to the SDK.
2016-05-06 19:56:11,607 INFO appcfg.py:2378 Reading app configuration.
07:56 PM
Starting update of app: glossy-apex-130310, version: v1
07:56 PM Getting current resource limits.
2016-05-06 19:56:11,608 INFO appcfg.py:1693 Send: /api/appversion/getresourcelimits, params={'version': 'v1', 'app_id': 'glossy-apex-130310'}
2016-05-06 19:56:12,350 ERROR appcfg.py:2396 An error occurred processing file '': HTTP Error 403: Forbidden Unexpected HTTP status 403. Aborting.
Error 403: --- begin server output ---
You do not have permission to modify this app (app_id=u's~glossy-apex-130310').
--- end server output ---

所以我像这样部署它:

gcloud preview app deploy --project glossy-apex-130310

http://glossy-apex-130310.appspot.com/ 得到这个     内部服务器错误

The server has either erred or is incapable of performing the requested operation.

Traceback (most recent call last):
  File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1535, in __call__
    rv = self.handle_exception(request, response, e)
  File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1529, in __call__
    rv = self.router.dispatch(request, response)
  File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1278, in default_dispatcher
    return route.handler_adapter(request, response)
  File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1102, in __call__
    return handler.dispatch()
  File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 572, in dispatch
    return self.handle_exception(e, self.app.debug)
  File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 570, in dispatch
    return method(*args, **kwargs)
  File "/base/data/home/apps/s~glossy-apex-130310/20160506t132909.392595029440587911/guestbook.py", line 72, in get
    greetings = greetings_query.fetch(10)
  File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/ext/ndb/utils.py", line 160, in positional_wrapper
    return wrapped(*args, **kwds)
  File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/ext/ndb/query.py", line 1203, in fetch
    return self.fetch_async(limit, **q_options).get_result()
  File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/ext/ndb/tasklets.py", line 378, in get_result
    self.check_success()
  File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/ext/ndb/tasklets.py", line 422, in _help_tasklet_along
    value = gen.throw(exc.__class__, exc, tb)
  File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/ext/ndb/query.py", line 980, in _run_to_list
    batch = yield rpc
  File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/ext/ndb/tasklets.py", line 508, in _on_rpc_completion
    result = rpc.get_result()
  File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/api/apiproxy_stub_map.py", line 613, in get_result
    return self.__get_result_hook(self)
  File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/datastore/datastore_query.py", line 2921, in __query_result_hook
    yaml_index=yaml, xml_index=xml)
NeedIndexError: no matching index found. recommended index is:
- kind: Greeting
  ancestor: yes
  properties:
  - name: date
    direction: desc

The suggested index for this query is:
- kind: Greeting
  ancestor: yes
  properties:
  - name: date
    direction: desc

index.yaml文件是

indexes:
- kind: Greeting
  ancestor: yes
  properties:
  - name: date
    direction: desc

我读到我应该等一会儿。已经4个小时了。

这里没有创建索引 https://console.cloud.google.com/datastore/indexes?project=glossy-apex-130310

1 个答案:

答案 0 :(得分:2)

gcloud sdk可以使用create-indexes命令将索引上传到云数据存储区,如下所示(docs):

$ gcloud preview datastore create-indexes ~/myapp/index.yaml

使用update command执行appcfg.py时,App Engine SDK会将索引与应用程序代码一起上传:

$ appcfg.py -A <YOUR_PROJECT_ID> update myapp/

使用update_indexes command

执行appcfg.py时,可以单独上传

或索引

appcfg.py update_indexes myapp/