尝试将 'application_readable: true' 添加到 app.yaml 文件时出错

Error while trying to add 'application_readable: true' to app.yaml file

我一直在尝试将此 application_readable: true 添加到 app.yaml 文件,但出现此错误!

    Traceback (most recent call last):
  File "/google/google-cloud-sdk/platform/google_appengine/dev_appserver.py", line 103, in <module>
    _run_file(__file__, globals())
  File "/google/google-cloud-sdk/platform/google_appengine/dev_appserver.py", line 97, in _run_file
    execfile(_PATHS.script_file(script_name), globals_)
  File "/google/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 381, in <module>
    main()
  File "/google/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 369, in main
    dev_server.start(options)
  File "/google/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 105, in start
    env_variables=parsed_env_variables)
  File "/google/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/application_configuration.py", line 864, in __init__
    env_variables)
  File "/google/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/application_configuration.py", line 131, in __init__
    self._config_path)
  File "/google/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/application_configuration.py", line 454, in _parse_configuration
    config, files = appinfo_includes.ParseAndReturnIncludePaths(f)
  File "/google/google-cloud-sdk/platform/google_appengine/google/appengine/api/appinfo_includes.py", line 82, in ParseAndReturnIncludePaths
    appyaml = appinfo.LoadSingleAppInfo(appinfo_file)
  File "/google/google-cloud-sdk/platform/google_appengine/google/appengine/api/appinfo.py", line 2482, in LoadSingleAppInfo
    listener.Parse(app_info)
  File "/google/google-cloud-sdk/platform/google_appengine/google/appengine/api/yaml_listener.py", line 227, in Parse
    self._HandleEvents(self._GenerateEventParameters(stream, loader_class))
  File "/google/google-cloud-sdk/platform/google_appengine/google/appengine/api/yaml_listener.py", line 178, in _HandleEvents
    raise yaml_errors.EventError(e, event_object)
google.appengine.api.yaml_errors.EventError: Unexpected attribute "application_readable" for mapping type script.
  in "app.yaml", line 10, column 

我的app.yaml文件是这样的

runtime: python27
api_version: 1
threadsafe: true

handlers:
- url: /.*
  script: main.app
  application_readable: true

问题出在哪里?!

application_readable 标志仅对 static_files and/or static_dir 类型处理程序有意义。这是因为静态内容默认存储在与应用程序代码不同的位置。来自 Handlers element:

application_readable

Optional. Boolean. By default, files declared in static file handlers are uploaded as static data and are only served to end users. They cannot be read by an application. If this field is set to true, the files are also uploaded as code data so your application can read them. Both uploads are charged against your code and static data storage resource quotas.

非静态处理程序的脚本已经是应用程序的一部分,添加标志没有多大意义。当然,有人可能会争辩说这可以做得比这更友好:)

所以不要为非静态处理程序添加该标志,您应该没问题。