使用Google App Engine SDK在Go中进行简单应用

时间:2014-04-19 08:53:57

标签: google-app-engine go

当我关注Google-Developers'使用App Engine SDK for Go在Go中创建一个简单应用程序的教程,同时运行命令

goapp serve

我收到以下错误:

Traceback (most recent call last):
File "/home/kamal/go_appengine/dev_appserver.py", line 82, in <module>
_run_file(__file__, globals())
File "/home/kamal/go_appengine/dev_appserver.py", line 78, in _run_file
execfile(_PATHS.script_file(script_name), globals_)
File "/home/kamal/go_appengine/google/appengine/tools/devappserver2/devappserver2.py",   line 1001, in <module>
main()
File "/home/kamal/go_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 994, in main
dev_server.start(options)
File "/home/kamal/go_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 754, in start
options.config_paths)
File "/home/kamal/go_appengine/google/appengine/tools/devappserver2/application_configuration.py", line 632, in __init__
module_configuration = ModuleConfiguration(config_path)
File "/home/kamal/go_appengine/google/appengine/tools/devappserver2/application_configuration.py", line 97, in __init__
self._config_path)
File "/home/kamal/go_appengine/google/appengine/tools/devappserver2/application_configuration.py", line 316, in _parse_configuration
config, files = appinfo_includes.ParseAndReturnIncludePaths(f)
File "/home/kamal/go_appengine/google/appengine/api/appinfo_includes.py", line 81, in ParseAndReturnIncludePaths
appyaml = appinfo.LoadSingleAppInfo(appinfo_file)
File "/home/kamal/go_appengine/google/appengine/api/appinfo.py", line 1873, in LoadSingleAppInfo
listener.Parse(app_info)
File "/home/kamal/go_appengine/google/appengine/api/yaml_listener.py", line 226, in Parse
self._HandleEvents(self._GenerateEventParameters(stream, loader_class))
File "/home/kamal/go_appengine/google/appengine/api/yaml_listener.py", line 177, in _HandleEvents
raise yaml_errors.EventError(e, event_object)
google.appengine.api.yaml_errors.EventError: Unknown url handler type.
URLMap 
auth_fail_action=redirect 
static_dir=None 
secure=default 
http_headers=None 
url=/.* 
static_files=None 
expiration=None 
upload=None 
api_endpoint=None 
script=None 
application_readable=None 
position=None 
login=optional 
mime_type=None 
require_matching_file=None
in "myapp/app.yaml", line 8, column 1
error while running dev_appserver.py: exit status 1

我不知道如何调试它。只是暗示就足够了。 还有,因为我没有安装Web服务器吗?我是否必须为goapp serve安装Apache或Nginx,或者自己处理服务器内容?

1 个答案:

答案 0 :(得分:3)

问题是script文件handlers.yaml的缩进。 我最初是这样做的:

handlers:
- url: /.*
script: _go_app

虽然它应该是:

handlers:
  - url: /.*
    script: _go_app

现在有效!