草庐IT

google-app-engine - 谷歌应用引擎去 SDK : Request to '/' failed

coder 2024-07-08 原文

我刚刚开始使用 GAE,我在这里有以下指南 https://developers.google.com/appengine/docs/go/gettingstarted/devenvironment和这里的一些 hello word 教程 https://developers.google.com/appengine/docs/go/gettingstarted/helloworld .

我的问题是当我输入 goapp serve 时它起作用了。并像这样显示日志:

INFO     2014-05-18 08:44:57,130 devappserver2.py:765] Skipping SDK update check.
WARNING  2014-05-18 08:44:57,135 api_server.py:374] Could not initialize images API; you are likely missing the Python "PIL" module.
INFO     2014-05-18 08:44:57,140 api_server.py:171] Starting API server at: http://localhost:59559
INFO     2014-05-18 08:44:57,154 dispatcher.py:182] Starting module "default" running at: http://localhost:8080
INFO     2014-05-18 08:44:57,156 admin_server.py:117] Starting admin server at: http://localhost:8000

但是,当我尝试访问 http://localhost:8080 时,它没有向我显示“hello, world!”在浏览器中。错误日志显示如下:

ERROR    2014-05-18 08:48:05,002 module.py:714] Request to '/' failed
Traceback (most recent call last):
File "/home/bayu/.go_appengine/google/appengine/tools/devappserver2/module.py", line 708, in _handle_request
environ, wrapped_start_response)
File "/home/bayu/.go_appengine/google/appengine/tools/devappserver2/request_rewriter.py", line 311, in _rewriter_middleware
response_body = iter(application(environ, wrapped_start_response))
File "/home/bayu/.go_appengine/google/appengine/tools/devappserver2/module.py", line 1228, in _handle_script_request
request_type)
File "/home/bayu/.go_appengine/google/appengine/tools/devappserver2/instance.py", line 382, in handle
request_type))
File "/home/bayu/.go_appengine/google/appengine/tools/devappserver2/http_proxy.py", line 148, in handle
connection.connect()
File "/home/bayu/.pyenv/versions/2.7.6/lib/python2.7/httplib.py", line 772, in connect
self.timeout, self.source_address)
File "/home/bayu/.pyenv/versions/2.7.6/lib/python2.7/socket.py", line 571, in create_connection
raise err
error: [Errno 111] Connection refused
INFO     2014-05-18 08:48:05,007 module.py:639] default: "GET / HTTP/1.1" 500 -

我已经用谷歌搜索并在这里尝试另一个入门教程 http://blog.joshsoftware.com/2014/03/12/learn-to-build-and-deploy-simple-go-web-apps-part-one/ 但它也不起作用。

我该怎么办?

  • 我在 ubuntu 12.04,Python 2.7.3,go 版本 go1.2.1 linux/386
  • 使用 go_appengine_sdk_linux_386-1.9.4.zip

这是我的 hello.go 和 app.yaml

你好.go

package hello

import (
   "fmt"
   "net/http"
)

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

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

应用.yaml

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

handlers:
- url: /.*
  script: _go_app

谢谢你,

最佳答案

不确定这是否对任何人有帮助,但我遇到了完全相同的问题并最终追踪到我的主机文件。基本上发生的事情是应用程序引擎服务器在 0.0.0.0:8080 上运行,但界面/输出显示 localhost:8080。在我的主机文件中,0.0.0.0:8080 未映射到本地主机,因此:

  1. 用 vim 或其他工具编辑你的 /private/etc/hosts 文件
  2. 0.0.0.0 localhost 添加到您的主机文件
  3. 保存,启动一个新终端并再次尝试运行您的应用引擎服务器

在那个简单的编辑之后,一切都对我有用。

关于google-app-engine - 谷歌应用引擎去 SDK : Request to '/' failed,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23733570/

有关google-app-engine - 谷歌应用引擎去 SDK : Request to '/' failed的更多相关文章

  1. ruby-on-rails - rails : "missing partial" when calling 'render' in RSpec test - 2

    我正在尝试测试是否存在表单。我是Rails新手。我的new.html.erb_spec.rb文件的内容是:require'spec_helper'describe"messages/new.html.erb"doit"shouldrendertheform"dorender'/messages/new.html.erb'reponse.shouldhave_form_putting_to(@message)with_submit_buttonendendView本身,new.html.erb,有代码:当我运行rspec时,它失败了:1)messages/new.html.erbshou

  2. ruby-on-rails - 'compass watch' 是如何工作的/它是如何与 rails 一起使用的 - 2

    我在我的项目目录中完成了compasscreate.和compassinitrails。几个问题:我已将我的.sass文件放在public/stylesheets中。这是放置它们的正确位置吗?当我运行compasswatch时,它不会自动编译这些.sass文件。我必须手动指定文件:compasswatchpublic/stylesheets/myfile.sass等。如何让它自动运行?文件ie.css、print.css和screen.css已放在stylesheets/compiled。如何在编译后不让它们重新出现的情况下删除它们?我自己编译的.sass文件编译成compiled/t

  3. ruby-on-rails - Rails 3.2.1 中 ActionMailer 中的未定义方法 'default_content_type=' - 2

    我在我的项目中添加了一个系统来重置用户密码并通过电子邮件将密码发送给他,以防他忘记密码。昨天它运行良好(当我实现它时)。当我今天尝试启动服务器时,出现以下错误。=>BootingWEBrick=>Rails3.2.1applicationstartingindevelopmentonhttp://0.0.0.0:3000=>Callwith-dtodetach=>Ctrl-CtoshutdownserverExiting/Users/vinayshenoy/.rvm/gems/ruby-1.9.3-p0/gems/actionmailer-3.2.1/lib/action_mailer

  4. ruby - 在 jRuby 中使用 'fork' 生成进程的替代方案? - 2

    在MRIRuby中我可以这样做:deftransferinternal_server=self.init_serverpid=forkdointernal_server.runend#Maketheserverprocessrunindependently.Process.detach(pid)internal_client=self.init_client#Dootherstuffwithconnectingtointernal_server...internal_client.post('somedata')ensure#KillserverProcess.kill('KILL',

  5. ruby - 主要 :Object when running build from sublime 的未定义方法 `require_relative' - 2

    我已经从我的命令行中获得了一切,所以我可以运行rubymyfile并且它可以正常工作。但是当我尝试从sublime中运行它时,我得到了undefinedmethod`require_relative'formain:Object有人知道我的sublime设置中缺少什么吗?我正在使用OSX并安装了rvm。 最佳答案 或者,您可以只使用“require”,它应该可以正常工作。我认为“require_relative”仅适用于ruby​​1.9+ 关于ruby-主要:Objectwhenrun

  6. ruby - 无法让 RSpec 工作—— 'require' : cannot load such file - 2

    我花了三天的时间用头撞墙,试图弄清楚为什么简单的“rake”不能通过我的规范文件。如果您遇到这种情况:任何文件夹路径中都不要有空格!。严重地。事实上,从现在开始,您命名的任何内容都没有空格。这是我的控制台输出:(在/Users/*****/Desktop/LearningRuby/learn_ruby)$rake/Users/*******/Desktop/LearningRuby/learn_ruby/00_hello/hello_spec.rb:116:in`require':cannotloadsuchfile--hello(LoadError) 最佳

  7. ruby - 我可以使用 aws-sdk-ruby 在 AWS S3 上使用事务性文件删除/上传吗? - 2

    我发现ActiveRecord::Base.transaction在复杂方法中非常有效。我想知道是否可以在如下事务中从AWSS3上传/删除文件:S3Object.transactiondo#writeintofiles#raiseanexceptionend引发异常后,每个操作都应在S3上回滚。S3Object这可能吗?? 最佳答案 虽然S3API具有批量删除功能,但它不支持事务,因为每个删除操作都可以独立于其他操作成功/失败。该API不提供任何批量上传功能(通过PUT或POST),因此每个上传操作都是通过一个独立的API调用完成的

  8. ruby-on-rails - 新 Rails 项目 : 'bundle install' can't install rails in gemfile - 2

    我已经像这样安装了一个新的Rails项目:$railsnewsite它执行并到达:bundleinstall但是当它似乎尝试安装依赖项时我得到了这个错误Gem::Ext::BuildError:ERROR:Failedtobuildgemnativeextension./System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/rubyextconf.rbcheckingforlibkern/OSAtomic.h...yescreatingMakefilemake"DESTDIR="cleanmake"DESTDIR="

  9. ruby-on-rails - rspec should have_select ('cars' , :options => ['volvo' , 'saab' ] 不工作 - 2

    关闭。这个问题需要detailsorclarity.它目前不接受答案。想改进这个问题吗?通过editingthispost添加细节并澄清问题.关闭8年前。Improvethisquestion在首页我有:汽车:VolvoSaabMercedesAudistatic_pages_spec.rb中的测试代码:it"shouldhavetherightselect"dovisithome_pathit{shouldhave_select('cars',:options=>['volvo','saab','mercedes','audi'])}end响应是rspec./spec/request

  10. ruby - RuntimeError(自动加载常量 Apps 多线程时检测到循环依赖 - 2

    我收到这个错误:RuntimeError(自动加载常量Apps时检测到循环依赖当我使用多线程时。下面是我的代码。为什么会这样?我尝试多线程的原因是因为我正在编写一个HTML抓取应用程序。对Nokogiri::HTML(open())的调用是一个同步阻塞调用,需要1秒才能返回,我有100,000多个页面要访问,所以我试图运行多个线程来解决这个问题。有更好的方法吗?classToolsController0)app.website=array.join(',')putsapp.websiteelseapp.website="NONE"endapp.saveapps=Apps.order("

随机推荐