Heroku 内部服务器错误 - ruby / Sinatra / Postgresql
Heroku Internal server error - ruby / Sinatra / Postgresql
我完成了学习 ruby、Sinatra 和 Postgresql 的教程。我的测试通过了,应用程序在我的机器上本地运行,带有 rackup 和 localhost:9292。我正在尝试在 Heroku 上导出应用程序,当我继续 Heroku url 时收到以下消息:‘Internal Server error’
这似乎是 Heroku 的常见错误消息,但我无法与我在 Whosebug 上发现的面临此错误的任何类似主题相关联。我感觉这可能是数据库问题,但按照 Brian 的建议(见下文),我创建了数据库。请在下面找到完整的 Heroku 日志:
2015-06-30T08:21:54.511756+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:218:in <code>call'
2015-06-30T08:21:54.511757+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:211:in
call'
2015-06-30T08:21:54.511758+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.1/lib/rack/head.rb:13:in call'
2015-06-30T08:21:54.511760+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.1/lib/rack/methodoverride.rb:22:in
call'
2015-06-30T08:21:54.511761+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:181:in call'
2015-06-30T08:21:54.511762+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:2021:in
call'
2015-06-30T08:21:54.511763+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1486:in block in call'
2015-06-30T08:21:54.511765+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1795:in
synchronize'
2015-06-30T08:21:54.511766+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1486:in call'
2015-06-30T08:21:54.511767+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.1/lib/rack/handler/webrick.rb:89:in
service'
2015-06-30T08:21:54.511769+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:138:in service'
2015-06-30T08:21:54.511770+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:94:in
run'
2015-06-30T08:21:54.511771+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:295:in block in start_thread'
2015-06-30T08:21:54.512062+00:00 app[web.1]: 62.252.214.33 - - [30/Jun/2015:08:21:54 +0000] "GET / HTTP/1.1" 500 30 0.0023
2015-06-30T08:48:18.429835+00:00 heroku[api]: Starting process with command
rails consoleby guillaume.bouffard@hotmail.co.uk
2015-06-30T08:48:21.683429+00:00 heroku[run.3694]: Awaiting client
2015-06-30T08:48:21.711122+00:00 heroku[run.3694]: Starting process with command
rails console
2015-06-30T08:48:22.102369+00:00 heroku[run.3694]: State changed from starting to up
2015-06-30T08:48:23.553202+00:00 heroku[run.3694]: State changed from up to complete
2015-06-30T08:48:23.542808+00:00 heroku[run.3694]: Process exited with status 127
2015-06-30T08:54:15.444683+00:00 heroku[router]: at=info method=GET path="/" host=guillaume-bookmark-manager.herokuapp.com request_id=044274e4-694c-47e3-8ee5-1ac35ae8a5c9 fwd="62.252.214.33" dyno=web.1 connect=0ms service=44ms status=500 bytes=326
2015-06-30T08:54:15.446539+00:00 app[web.1]: 2015-06-30 08:54:15 - DataObjects::ConnectionError - could not connect to server: Connection refused
2015-06-30T08:54:15.446547+00:00 app[web.1]: Is the server running on host "localhost" (127.0.0.1) and accepting
2015-06-30T08:54:15.446549+00:00 app[web.1]: TCP/IP connections on port 5432?
2015-06-30T08:54:15.446551+00:00 app[web.1]: :
2015-06-30T08:54:15.446553+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/data_objects-0.10.15/lib/data_objects/connection.rb:79:in
initialize'
2015-06-30T08:54:15.446554+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/data_objects-0.10.15/lib/data_objects/connection.rb:79:in new'
2015-06-30T08:54:15.446556+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/data_objects-0.10.15/lib/data_objects/pooling.rb:181:in
block in new'
2015-06-30T08:54:15.446557+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/data_objects-0.10.15/lib/data_objects/pooling.rb:176:in synchronize'
2015-06-30T08:54:15.446559+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/data_objects-0.10.15/lib/data_objects/pooling.rb:176:in
new'
2015-06-30T08:54:15.446560+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/data_objects-0.10.15/lib/data_objects/pooling.rb:121:in new'
2015-06-30T08:54:15.446562+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/data_objects-0.10.15/lib/data_objects/connection.rb:68:in
new'
2015-06-30T08:54:15.446563+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/dm-do-adapter-1.2.0/lib/dm-do-adapter/adapter.rb:251:in open_connection'
2015-06-30T08:54:15.446565+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/dm-transactions-1.2.0/lib/dm-transactions/adapters/dm-do-adapter.rb:69:in
open_connection'
2015-06-30T08:54:15.446593+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/dm-do-adapter-1.2.0/lib/dm-do-adapter/adapter.rb:276:in with_connection'
2015-06-30T08:54:15.446594+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/dm-do-adapter-1.2.0/lib/dm-do-adapter/adapter.rb:141:in
read'
2015-06-30T08:54:15.446597+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/dm-core-1.2.1/lib/dm-core/repository.rb:162:in read'
2015-06-30T08:54:15.446598+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/dm-core-1.2.1/lib/dm-core/collection.rb:1118:in
lazy_load'
2015-06-30T08:54:15.446599+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/dm-core-1.2.1/lib/dm-core/support/lazy_array.rb:409:in each'
2015-06-30T08:54:15.446601+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/dm-core-1.2.1/lib/dm-core/collection.rb:505:in
each'
2015-06-30T08:54:15.446602+00:00 app[web.1]: /app/app/views/index.erb:2:in block in singleton class'
2015-06-30T08:54:15.446604+00:00 app[web.1]: /app/app/views/index.erb:-6:in
instance_eval'
2015-06-30T08:54:15.446605+00:00 app[web.1]: /app/app/views/index.erb:-6:in singleton class'
2015-06-30T08:54:15.446606+00:00 app[web.1]: /app/app/views/index.erb:-8:in
__tilt_70282199490340'
2015-06-30T08:54:15.446607+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/tilt-2.0.1/lib/tilt/template.rb:155:in call'
2015-06-30T08:54:15.446609+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/tilt-2.0.1/lib/tilt/template.rb:155:in
evaluate'
2015-06-30T08:54:15.446610+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/tilt-2.0.1/lib/tilt/template.rb:96:in render'
2015-06-30T08:54:15.446612+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:822:in
render'
2015-06-30T08:54:15.446613+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:666:in erb'
2015-06-30T08:54:15.446615+00:00 app[web.1]: /app/app/server.rb:25:in
block in '
2015-06-30T08:54:15.446616+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1610:in call'
2015-06-30T08:54:15.446617+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1610:in
block in compile!'
2015-06-30T08:54:15.446619+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:974:in []'
2015-06-30T08:54:15.446620+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:974:in
block (3 levels) in route!'
2015-06-30T08:54:15.446621+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:993:in route_eval'
2015-06-30T08:54:15.446623+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:974:in
block (2 levels) in route!'
2015-06-30T08:54:15.446624+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1014:in block in process_route'
2015-06-30T08:54:15.446625+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1012:in
catch'
2015-06-30T08:54:15.446627+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1012:in process_route'
2015-06-30T08:54:15.446629+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:971:in
each'
2015-06-30T08:54:15.446628+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:972:in block in route!'
2015-06-30T08:54:15.446630+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:971:in
route!'
2015-06-30T08:54:15.446631+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1084:in block in dispatch!'
2015-06-30T08:54:15.446633+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1066:in
block in invoke'
2015-06-30T08:54:15.446634+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1066:in catch'
2015-06-30T08:54:15.446635+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1066:in
invoke'
2015-06-30T08:54:15.446637+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1081:in dispatch!'
2015-06-30T08:54:15.446744+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1066:in
block in invoke'
2015-06-30T08:54:15.446746+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1066:in catch'
2015-06-30T08:54:15.446748+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1066:in
invoke'
2015-06-30T08:54:15.446638+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:906:in block in call!'
2015-06-30T08:54:15.446749+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:906:in
call!'
2015-06-30T08:54:15.446750+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:894:in call'
2015-06-30T08:54:15.446752+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.1/lib/rack/methodoverride.rb:22:in
call'
2015-06-30T08:54:15.446753+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-flash3-1.0.5/lib/rack/flash.rb:124:in call'
2015-06-30T08:54:15.446755+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:in
call'
2015-06-30T08:54:15.446754+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-protection-1.5.3/lib/rack/protection/xss_header.rb:18:in call'
2015-06-30T08:54:15.446757+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:in
call'
2015-06-30T08:54:15.446758+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-protection-1.5.3/lib/rack/protection/path_traversal.rb:16:in call'
2015-06-30T08:54:15.446760+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-protection-1.5.3/lib/rack/protection/json_csrf.rb:18:in
call'
2015-06-30T08:54:15.446769+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:in call'
2015-06-30T08:54:15.446770+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:in
call'
2015-06-30T08:54:15.446772+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-protection-1.5.3/lib/rack/protection/frame_options.rb:31:in call'
2015-06-30T08:54:15.446773+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.1/lib/rack/session/abstract/id.rb:225:in
context'
2015-06-30T08:54:15.446774+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.1/lib/rack/session/abstract/id.rb:220:in call'
2015-06-30T08:54:15.446776+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.1/lib/rack/logger.rb:15:in
call'
2015-06-30T08:54:15.446777+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.1/lib/rack/commonlogger.rb:33:in call'
2015-06-30T08:54:15.446779+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:218:in
call'
2015-06-30T08:54:15.446780+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:211:in call'
2015-06-30T08:54:15.446781+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.1/lib/rack/head.rb:13:in
call'
2015-06-30T08:54:15.446782+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.1/lib/rack/methodoverride.rb:22:in call'
2015-06-30T08:54:15.446784+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:181:in
call'
2015-06-30T08:54:15.446785+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:2021:in call'
2015-06-30T08:54:15.446786+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1486:in
block in call'
2015-06-30T08:54:15.446789+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1486:in call'
2015-06-30T08:54:15.446790+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.1/lib/rack/handler/webrick.rb:89:in
service'
2015-06-30T08:54:15.446787+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1795:in synchronize'
2015-06-30T08:54:15.446791+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:138:in
service'
2015-06-30T08:54:15.446792+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:94:in run'
2015-06-30T08:54:15.446823+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:295:in
block in start_thread'
2015-06-30T08:54:15.447548+00:00 app[web.1]: 62.252.214.33 - - [30/Jun/2015:08:54:15 +0000] "GET / HTTP/1.1" 500 30 0.0032
这里是 link 到 repository。
如果需要任何其他信息,请告诉我;它也将提高我的调试技能,知道如何在未来自己解决 Heroku 错误。
发生这种情况是因为您的应用似乎配置为连接到托管在与应用相同的服务器 (localhost) 上的数据库。 Heroku 不是这样工作的。
您需要:
- 附加数据库:
heroku addons:create heroku-postgresql:hobby-dev
- 将您的应用设置为连接到 Heroku DB
#2 的做法如下:
创建数据库后,heroku 将连接字符串添加到您的实例环境变量中,可以通过以下方式访问:ENV['DATABASE_URL']
DataObjects::Connection.new(ENV['DATABASE_URL'])
如果您 运行 遇到 DATABASE_URL 的问题,您可以检查 URL Heroku 分配给您的新数据库连接字符串的内容:
heroku config -s | grep HEROKU_POSTGRESQL
我完成了学习 ruby、Sinatra 和 Postgresql 的教程。我的测试通过了,应用程序在我的机器上本地运行,带有 rackup 和 localhost:9292。我正在尝试在 Heroku 上导出应用程序,当我继续 Heroku url 时收到以下消息:‘Internal Server error’
这似乎是 Heroku 的常见错误消息,但我无法与我在 Whosebug 上发现的面临此错误的任何类似主题相关联。我感觉这可能是数据库问题,但按照 Brian 的建议(见下文),我创建了数据库。请在下面找到完整的 Heroku 日志:
2015-06-30T08:21:54.511756+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:218:in <code>call' 2015-06-30T08:21:54.511757+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:211:in
call' 2015-06-30T08:21:54.511758+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.1/lib/rack/head.rb:13:incall' 2015-06-30T08:21:54.511760+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.1/lib/rack/methodoverride.rb:22:in
call' 2015-06-30T08:21:54.511761+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:181:incall' 2015-06-30T08:21:54.511762+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:2021:in
call' 2015-06-30T08:21:54.511763+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1486:inblock in call' 2015-06-30T08:21:54.511765+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1795:in
synchronize' 2015-06-30T08:21:54.511766+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1486:incall' 2015-06-30T08:21:54.511767+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.1/lib/rack/handler/webrick.rb:89:in
service' 2015-06-30T08:21:54.511769+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:138:inservice' 2015-06-30T08:21:54.511770+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:94:in
run' 2015-06-30T08:21:54.511771+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:295:inblock in start_thread' 2015-06-30T08:21:54.512062+00:00 app[web.1]: 62.252.214.33 - - [30/Jun/2015:08:21:54 +0000] "GET / HTTP/1.1" 500 30 0.0023 2015-06-30T08:48:18.429835+00:00 heroku[api]: Starting process with command
rails consoleby guillaume.bouffard@hotmail.co.uk 2015-06-30T08:48:21.683429+00:00 heroku[run.3694]: Awaiting client 2015-06-30T08:48:21.711122+00:00 heroku[run.3694]: Starting process with command
rails console2015-06-30T08:48:22.102369+00:00 heroku[run.3694]: State changed from starting to up 2015-06-30T08:48:23.553202+00:00 heroku[run.3694]: State changed from up to complete 2015-06-30T08:48:23.542808+00:00 heroku[run.3694]: Process exited with status 127 2015-06-30T08:54:15.444683+00:00 heroku[router]: at=info method=GET path="/" host=guillaume-bookmark-manager.herokuapp.com request_id=044274e4-694c-47e3-8ee5-1ac35ae8a5c9 fwd="62.252.214.33" dyno=web.1 connect=0ms service=44ms status=500 bytes=326 2015-06-30T08:54:15.446539+00:00 app[web.1]: 2015-06-30 08:54:15 - DataObjects::ConnectionError - could not connect to server: Connection refused 2015-06-30T08:54:15.446547+00:00 app[web.1]: Is the server running on host "localhost" (127.0.0.1) and accepting 2015-06-30T08:54:15.446549+00:00 app[web.1]: TCP/IP connections on port 5432? 2015-06-30T08:54:15.446551+00:00 app[web.1]: : 2015-06-30T08:54:15.446553+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/data_objects-0.10.15/lib/data_objects/connection.rb:79:in
initialize' 2015-06-30T08:54:15.446554+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/data_objects-0.10.15/lib/data_objects/connection.rb:79:innew' 2015-06-30T08:54:15.446556+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/data_objects-0.10.15/lib/data_objects/pooling.rb:181:in
block in new' 2015-06-30T08:54:15.446557+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/data_objects-0.10.15/lib/data_objects/pooling.rb:176:insynchronize' 2015-06-30T08:54:15.446559+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/data_objects-0.10.15/lib/data_objects/pooling.rb:176:in
new' 2015-06-30T08:54:15.446560+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/data_objects-0.10.15/lib/data_objects/pooling.rb:121:innew' 2015-06-30T08:54:15.446562+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/data_objects-0.10.15/lib/data_objects/connection.rb:68:in
new' 2015-06-30T08:54:15.446563+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/dm-do-adapter-1.2.0/lib/dm-do-adapter/adapter.rb:251:inopen_connection' 2015-06-30T08:54:15.446565+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/dm-transactions-1.2.0/lib/dm-transactions/adapters/dm-do-adapter.rb:69:in
open_connection' 2015-06-30T08:54:15.446593+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/dm-do-adapter-1.2.0/lib/dm-do-adapter/adapter.rb:276:inwith_connection' 2015-06-30T08:54:15.446594+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/dm-do-adapter-1.2.0/lib/dm-do-adapter/adapter.rb:141:in
read' 2015-06-30T08:54:15.446597+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/dm-core-1.2.1/lib/dm-core/repository.rb:162:inread' 2015-06-30T08:54:15.446598+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/dm-core-1.2.1/lib/dm-core/collection.rb:1118:in
lazy_load' 2015-06-30T08:54:15.446599+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/dm-core-1.2.1/lib/dm-core/support/lazy_array.rb:409:ineach' 2015-06-30T08:54:15.446601+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/dm-core-1.2.1/lib/dm-core/collection.rb:505:in
each' 2015-06-30T08:54:15.446602+00:00 app[web.1]: /app/app/views/index.erb:2:inblock in singleton class' 2015-06-30T08:54:15.446604+00:00 app[web.1]: /app/app/views/index.erb:-6:in
instance_eval' 2015-06-30T08:54:15.446605+00:00 app[web.1]: /app/app/views/index.erb:-6:insingleton class' 2015-06-30T08:54:15.446606+00:00 app[web.1]: /app/app/views/index.erb:-8:in
__tilt_70282199490340' 2015-06-30T08:54:15.446607+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/tilt-2.0.1/lib/tilt/template.rb:155:incall' 2015-06-30T08:54:15.446609+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/tilt-2.0.1/lib/tilt/template.rb:155:in
evaluate' 2015-06-30T08:54:15.446610+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/tilt-2.0.1/lib/tilt/template.rb:96:inrender' 2015-06-30T08:54:15.446612+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:822:in
render' 2015-06-30T08:54:15.446613+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:666:inerb' 2015-06-30T08:54:15.446615+00:00 app[web.1]: /app/app/server.rb:25:in
block in ' 2015-06-30T08:54:15.446616+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1610:incall' 2015-06-30T08:54:15.446617+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1610:in
block in compile!' 2015-06-30T08:54:15.446619+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:974:in[]' 2015-06-30T08:54:15.446620+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:974:in
block (3 levels) in route!' 2015-06-30T08:54:15.446621+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:993:inroute_eval' 2015-06-30T08:54:15.446623+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:974:in
block (2 levels) in route!' 2015-06-30T08:54:15.446624+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1014:inblock in process_route' 2015-06-30T08:54:15.446625+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1012:in
catch' 2015-06-30T08:54:15.446627+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1012:inprocess_route' 2015-06-30T08:54:15.446629+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:971:in
each' 2015-06-30T08:54:15.446628+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:972:inblock in route!' 2015-06-30T08:54:15.446630+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:971:in
route!' 2015-06-30T08:54:15.446631+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1084:inblock in dispatch!' 2015-06-30T08:54:15.446633+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1066:in
block in invoke' 2015-06-30T08:54:15.446634+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1066:incatch' 2015-06-30T08:54:15.446635+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1066:in
invoke' 2015-06-30T08:54:15.446637+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1081:indispatch!' 2015-06-30T08:54:15.446744+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1066:in
block in invoke' 2015-06-30T08:54:15.446746+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1066:incatch' 2015-06-30T08:54:15.446748+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1066:in
invoke' 2015-06-30T08:54:15.446638+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:906:inblock in call!' 2015-06-30T08:54:15.446749+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:906:in
call!' 2015-06-30T08:54:15.446750+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:894:incall' 2015-06-30T08:54:15.446752+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.1/lib/rack/methodoverride.rb:22:in
call' 2015-06-30T08:54:15.446753+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-flash3-1.0.5/lib/rack/flash.rb:124:incall' 2015-06-30T08:54:15.446755+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:in
call' 2015-06-30T08:54:15.446754+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-protection-1.5.3/lib/rack/protection/xss_header.rb:18:incall' 2015-06-30T08:54:15.446757+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:in
call' 2015-06-30T08:54:15.446758+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-protection-1.5.3/lib/rack/protection/path_traversal.rb:16:incall' 2015-06-30T08:54:15.446760+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-protection-1.5.3/lib/rack/protection/json_csrf.rb:18:in
call' 2015-06-30T08:54:15.446769+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:incall' 2015-06-30T08:54:15.446770+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:in
call' 2015-06-30T08:54:15.446772+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-protection-1.5.3/lib/rack/protection/frame_options.rb:31:incall' 2015-06-30T08:54:15.446773+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.1/lib/rack/session/abstract/id.rb:225:in
context' 2015-06-30T08:54:15.446774+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.1/lib/rack/session/abstract/id.rb:220:incall' 2015-06-30T08:54:15.446776+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.1/lib/rack/logger.rb:15:in
call' 2015-06-30T08:54:15.446777+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.1/lib/rack/commonlogger.rb:33:incall' 2015-06-30T08:54:15.446779+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:218:in
call' 2015-06-30T08:54:15.446780+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:211:incall' 2015-06-30T08:54:15.446781+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.1/lib/rack/head.rb:13:in
call' 2015-06-30T08:54:15.446782+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.1/lib/rack/methodoverride.rb:22:incall' 2015-06-30T08:54:15.446784+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:181:in
call' 2015-06-30T08:54:15.446785+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:2021:incall' 2015-06-30T08:54:15.446786+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1486:in
block in call' 2015-06-30T08:54:15.446789+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1486:incall' 2015-06-30T08:54:15.446790+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.1/lib/rack/handler/webrick.rb:89:in
service' 2015-06-30T08:54:15.446787+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1795:insynchronize' 2015-06-30T08:54:15.446791+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:138:in
service' 2015-06-30T08:54:15.446792+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:94:inrun' 2015-06-30T08:54:15.446823+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:295:in
block in start_thread' 2015-06-30T08:54:15.447548+00:00 app[web.1]: 62.252.214.33 - - [30/Jun/2015:08:54:15 +0000] "GET / HTTP/1.1" 500 30 0.0032
这里是 link 到 repository。
如果需要任何其他信息,请告诉我;它也将提高我的调试技能,知道如何在未来自己解决 Heroku 错误。
发生这种情况是因为您的应用似乎配置为连接到托管在与应用相同的服务器 (localhost) 上的数据库。 Heroku 不是这样工作的。
您需要:
- 附加数据库:
heroku addons:create heroku-postgresql:hobby-dev
- 将您的应用设置为连接到 Heroku DB
#2 的做法如下:
创建数据库后,heroku 将连接字符串添加到您的实例环境变量中,可以通过以下方式访问:ENV['DATABASE_URL']
DataObjects::Connection.new(ENV['DATABASE_URL'])
如果您 运行 遇到 DATABASE_URL 的问题,您可以检查 URL Heroku 分配给您的新数据库连接字符串的内容:
heroku config -s | grep HEROKU_POSTGRESQL