GAE Python应用程序无法启动"在应用程序配置中找不到URLMap条目"

时间:2017-10-07 06:02:30

标签: python google-app-engine

我正在关注#34; Google App Engine with Python"并创建了一个名为clock的目录,其中包含两个名为app.yamlmain.py的文件,我已经完全从书中复制了代码,但我无法使用{ {1}}。我认为它可能与dev_appserver.py中的URL处理程序有关,但正如我所说,我已完全复制它,所以不确定问题是什么。当我在终端中运行app.yaml时,会发生这种情况:

dev_appserver.py clock

以下是我的app.yaml代码:

    Traceback (most recent call last):
  File "/Users/James/google-cloud-sdk/platform/google_appengine/dev_appserver.py", line 103, in <module>
    _run_file(__file__, globals())
  File "/Users/James/google-cloud-sdk/platform/google_appengine/dev_appserver.py", line 97, in _run_file
    execfile(_PATHS.script_file(script_name), globals_)
  File "/Users/James/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 346, in <module>
    main()
  File "/Users/James/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 334, in main
    dev_server.start(options)
  File "/Users/James/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 94, in start
    env_variables=parsed_env_variables)
  File "/Users/James/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/application_configuration.py", line 929, in __init__
    env_variables)
  File "/Users/James/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/application_configuration.py", line 132, in __init__
    self._config_path)
  File "/Users/James/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/application_configuration.py", line 499, in _parse_configuration
    config, files = appinfo_includes.ParseAndReturnIncludePaths(f)
  File "/Users/James/google-cloud-sdk/platform/google_appengine/google/appengine/api/appinfo_includes.py", line 93, in ParseAndReturnIncludePaths
    'No URLMap entries found in application configuration')
google.appengine.api.appinfo_errors.MissingURLMapping: No URLMap entries found in application configuration

这是我的main.py

代码
application: clock
version: 1
runtime: python27
api_version: 1
threadsafe: yes

handlers:
- url: .*

script: main.application

libraries:
- name: webapp2
  version: "2.5.2"

有人可以帮忙吗?

1 个答案:

答案 0 :(得分:1)

app.yaml中的handlers部分格式不正确。 script:部分需要在url模式下缩进,如下所示:

handlers:
- url: .*
  script: main.application