【问题标题】:Unexpected attribute 'name' for object of type Index索引类型对象的意外属性“名称”
【发布时间】:2023-03-26 04:24:01
【问题描述】:

python新手请帮忙

indexes:


# AUTOGENERATED
# This index.yaml is automatically updated whenever the dev_appserver
# detects that a new type of query is run.  If you want to manage the
# index.yaml file manually, remove the above marker line (the line
# saying "# AUTOGENERATED").  If you want to manage some indexes
# manually, move them above the marker line.  The index.yaml file is
# automatically uploaded to the admin console when you next deploy
# your application using appcfg.py.

 - kind: Post 
 properties: 
 - name: user 
 - name: created 
   direction: desc

   - kind: Post
  ancestor: yes
  properties:
  - name: created
    direction: desc

- kind: Post
  ancestor: yes
  properties:
  - name: date
    direction: desc

此处形成的错误是索引类型对象的意外属性“名称”。 使用以下命令时会发生这种情况

gcloud deploy app index.yaml

【问题讨论】:

    标签: python google-app-engine gcloud


    【解决方案1】:

    你的yaml文件缩进错误,应该是这样的:

    indexes:
    
    
    # AUTOGENERATED
    # This index.yaml is automatically updated whenever the dev_appserver
    # detects that a new type of query is run.  If you want to manage the
    # index.yaml file manually, remove the above marker line (the line
    # saying "# AUTOGENERATED").  If you want to manage some indexes
    # manually, move them above the marker line.  The index.yaml file is
    # automatically uploaded to the admin console when you next deploy
    # your application using appcfg.py.
    
    - kind: Post 
      properties: 
      - name: user 
      - name: created 
        direction: desc
    
    - kind: Post
      ancestor: yes
      properties:
      - name: created
        direction: desc
    
    - kind: Post
      ancestor: yes
      properties:
      - name: date
        direction: desc
    

    【讨论】:

      猜你喜欢
      • 2016-08-05
      • 1970-01-01
      • 2017-06-29
      • 1970-01-01
      • 2021-10-15
      • 1970-01-01
      • 2020-03-17
      • 2018-09-23
      • 2019-09-13
      相关资源
      最近更新 更多