2015-09-10 65 views
1

您能不能在Google AppEngine上帮助我,因为我看不到http://localhost:8080的任何响应,虽然我可以在下面看到运行... 另请注意,我也无法使用Ctrl + C关闭。我目前在Mac OSX 10.10.5上运行这个。运行Google AppEngine HelloWorld应用程序

hello.go

package hello 

import (
    "fmt" 
    "net/http" 
) 

func init() { 
    http.HandleFunc("/", handler) 
} 

func handler(w http.ResponseWriter, r *http.Request) { 
    fmt.Fprint(w, "Hello, world!") 
} 

的app.yaml

application: helloworld 
version: 1 
runtime: go 
api_version: go1 

handlers: 
- url: /.* 
    script: _go_app 

端子输出

INFO  2015-09-10 15:25:33,421 devappserver2.py:763] Skipping SDK update check. 
WARNING 2015-09-10 15:25:33,480 simple_search_stub.py:1126] Could not read search indexes from /var/folders/dw/j8wnb7bn3bb0x_lh0v_gb1nw0000gn/T/appengine.helloworld.someuser/search_indexes 
INFO  2015-09-10 15:25:33,483 api_server.py:205] Starting API server at: http://localhost:50462 
INFO  2015-09-10 15:25:33,487 dispatcher.py:197] Starting module "default" running at: http://localhost:8080 
INFO  2015-09-10 15:25:33,489 admin_server.py:118] Starting admin server at: http://localhost:8000 

回答

2

我试着重现你的问题,但是,我不能 - 代码运行精细。

运行的另一个终端上curl查询的网址,我看到其他终端

$ curl http://localhost:8080 
Hello, world!$ 

正是我应该,并且,在我运行goapp终端窗口,以下日志上线出现:

INFO  2015-09-12 18:00:35,470 module.py:737] default: "GET/HTTP/1.1" 200 13 
INFO  2015-09-12 18:00:52,841 module.py:737] default: "GET/HTTP/1.1" 200 13 
INFO  2015-09-12 18:00:53,324 module.py:737] default: "GET /favicon.ico HTTP/1.1" 200 13 

再次,正如他们应该。此外,当我切换到运行goapp终端,并击中控制-C,I看到,同样如预期:

^Cgoapp: caught SIGINT, waiting for dev_appserver.py to shut down 
INFO  2015-09-12 18:01:46,762 shutdown.py:45] Shutting down. 
INFO  2015-09-12 18:01:46,763 api_server.py:588] Applying all pending transactions and saving the datastore 
INFO  2015-09-12 18:01:46,763 api_server.py:591] Saving search indexes 
$ 

我也是在OSX 10.10.5(14F27)。你在不同的终端窗口上看到了curl命令,在后者和你正在运行的终端上你看到了什么goapp?当你将焦点转回到你正在运行的终端goapp并命中控制C时,你观察到了什么?

+0

感谢您的咨询。我的尝试与你所建议的完全一样,没有像以前那样改变行为。有什么办法可以看到日志吗? – digidhamu

+0

@digidhamu,确定你可以看到日志 - 如果你使用Mac OS X的GUI Runner,只需点击相应的图标;否则,你配音“终端输出”正是“日志”。顺便说一句,你说“没有改变行为”,但你从来没有显示卷曲的输出(理想情况下标志需要详细的细节当然)。 –

+0

我看不到“$ curl http:// localhost:8080”输出。你能帮忙吗? – digidhamu

相关问题