0

基本上我的应用程序在 localhost 中可以正常工作,但页面无法在 heroku 服务器上运行。我已经阅读了关于 stackoverflow 的类似问题,但大多数似乎都没有在 cedar 堆栈中创建 repo 的问题。

这是一个非常基本的应用程序(来自教程)。

编辑:这是日志

    2013-01-28T19:52:21+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-1.4.4/lib/rack/lock.rb:15:in `call'
2013-01-28T19:52:21+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:51:in `call'
2013-01-28T19:52:21+00:00 app[web.1]:   /usr/local/lib/ruby/1.9.1/webrick/httpserver.rb:70:in `run'
2013-01-28T19:52:21+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-1.4.4/lib/rack/content_length.rb:14:in `call'
2013-01-28T19:52:21+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:136:in `forward'
2013-01-28T19:52:21+00:00 app[web.1]: 
2013-01-28T19:52:21+00:00 app[web.1]:   /usr/local/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread'
2013-01-28T19:52:21+00:00 app[web.1]:   /usr/local/lib/ruby/1.9.1/webrick/httpserver.rb:111:in `service'
2013-01-28T19:52:21+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-1.4.4/lib/rack/handler/webrick.rb:59:in `service'
2013-01-28T19:52:21+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/railties-3.2.11/lib/rails/rack/log_tailer.rb:17:in `call'
2013-01-28T19:52:21+00:00 heroku[router]: at=info method=GET path=/pages/home host=vast-wave-3795.herokuapp.com fwd=91.237.136.162 dyno=web.1 queue=0 wait=12ms connect=44ms service=34ms status=500 bytes=643
2013-01-28T19:52:22+00:00 heroku[router]: at=info method=GET path=/favicon.ico host=vast-wave-3795.herokuapp.com fwd=91.237.136.162 dyno=web.1 queue=0 wait=0ms connect=2ms service=425ms status=304 bytes=0
2013-01-28T19:52:51+00:00 heroku[api]: Starting process with command `bundle exec rake db:migrate` by arisnr1client@gmail.com
2013-01-28T19:52:55+00:00 heroku[run.9316]: Await
ing client
2013-01-28T19:52:55+00:00 heroku[run.9316]: Starting process with command `bundle exec rake db:migrate`
2013-01-28T19:52:56+00:00 heroku[run.9316]: State changed from starting to up
2013-01-28T19:52:59+00:00 heroku[run.9316]: Client connection closed. Sending SIGHUP to all processes
2013-01-28T19:53:00+00:00 heroku[run.9316]: Process exited with status 1
2013-01-28T19:53:00+00:00 heroku[run.9316]: State changed from up to complete
2013-01-28T19:53:23+00:00 heroku[api]: Starting process with command `bundle exec rake db:migrate` by arisnr1client@gmail.com
2013-01-28T19:53:28+00:00 heroku[run.9652]: Starting process with command `bundle exec rake db:migrate`
2013-01-28T19:53:28+00:00 heroku[run.9652]: Awaiting client
2013-01-28T19:53:29+00:00 heroku[run.9652]: State changed from starting to up
2013-01-28T19:53:37+00:00 heroku[run.9652]: Process exited with status 1
2013-01-28T19:53:37+00:00 heroku[run.9652]: State changed from up to complete
2013-01-28T20:54:39+00:00 heroku[web.1]: Idling
2013-01-28T20:54:41+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2013-01-28T20:54:42+00:00 app[web.1]: [2013-01-28 20:54:42] ERROR SignalException: SIGTERM
2013-01-28T20:54:42+00:00 app[web.1]:   /usr/local/lib/ruby/1.9.1/webrick/server.rb:90:in `select'
2013-01-28T20:54:51+00:00 heroku[web.1]: Stopping remaining processes with SIGKILL
2013-01-28T20:54:51+00:00 heroku[web.1]: Error R12 (Exit timeout) -> At least one process failed to exit within 10 seconds of SIGTERM
2013-01-28T20:54:53+00:00 heroku[web.1]: Process exited with status 137
2013-01-28T20:54:53+00:00 heroku[web.1]: State changed from up to down
2013-01-29T11:17:09+00:00 heroku[web.1]: Unidling
2013-01-29T11:17:09+00:00 heroku[web.1]: State changed from down to starting
2013-01-29T11:17:13+00:00 heroku[web.1]: Starting process with command `bundle exec rails server -p 58836`
2013-01-29T11:17:18+00:00 app[web.1]: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/config/environment.rb:5)
2013-01-29T11:17:18+00:00 app[web.1]: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/config/environment.rb:5)
2013-01-29T11:17:21+00:00 app[web.1]: [2013-01-29 11:17:21] INFO  WEBrick 1.3.1
2013-01-29T11:17:21+00:00 app[web.1]: [2013-01-29 11:17:21] INFO  WEBrick::HTTPServer#start: pid=2 port=58836
2013-01-29T11:17:21+00:00 app[web.1]: [2013-01-29 11:17:21] INFO  ruby 1.9.2 (2011-07-09) [x86_64-linux]
2013-01-29T11:17:22+00:00 heroku[web.1]: State changed from starting to up
2013-01-29T11:17:23+00:
00 heroku[router]: at=info method=GET path=/ host=vast-wave-3795.herokuapp.com fwd=83.6.123.123 dyno=web.1 queue=0 wait=0ms connect=2ms service=348ms status=304 bytes=0
2013-01-29T11:17:24+00:00 heroku[router]: at=info method=GET path=/assets/rails.png host=vast-wave-3795.herokuapp.com fwd=83.6.123.123 dyno=web.1 queue=0 wait=0ms connect=1ms service=329ms status=304 bytes=0
2013-01-29T11:17:24+00:00 heroku[router]: at=info method=GET path=/favicon.ico host=vast-wave-3795.herokuapp.com fwd=83.6.123.123 dyno=web.1 queue=0 wait=0ms connect=1ms service=64ms status=304 bytes=0
2013-01-29T11:19:47+00:00 heroku[api]: Starting process with command `bundle exec rake db:schema:load` by arisnr1client@gmail.com
2013-01-29T11:19:51+00:00 heroku[run.2504]: Starting process with command `bundle exec rake db:schema:load`
2013-01-29T11:19:51+00:00 heroku[run.2504]: Awaiting client
2013-01-29T11:19:52+00:00 heroku[run.2504]: State changed from starting to up
2013-01-29T11:19:57+00:00 heroku[run.2504]: Client connection closed. Sending SIGHUP to all processes
2013-01-29T11:19:58+00:00 heroku[run.2504]: Process exited with status 1
2013-01-29T11:19:58+00:00 heroku[run.2504]: State changed from up to complete
2013-01-29T11:20:22+00:00 app[web.1]: Started GET "/pages/home" for 83.6.123.123 at 2013-01-29 11:20:22 +0000
2013-01-29T11:20:22+00:00 app[web.1]: => Ctrl-C to shutdown server
2013-01-29T11:20:22+00:00 app[web.1]: => Booting WEBrick
2013-01-29T11:20:22+00:00 app[web.1]: => Rails 3.2.11 application starting in production on http://0.0.0.0:58836
2013-01-29T11:20:22+00:00 app[web.1]: => Call with -d to detach
2013-01-29T11:20:22+00:00 app[web.1]: Connecting to database specified by DATABASE_URL
2013-01-29T11:20:22+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_pool.rb:410:in `retrieve_connection'
2013-01-29T11:20:22+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_specification.rb:145:in `connection'
2013-01-29T11:20:22+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/query_cache.rb:67:in `rescue in call'
2013-01-29T11:20:22+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/query_cache.rb:61:in `call'
2013-01-29T11:20:22+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:405:in `__run_callback'
2013-01-29T11:20:22+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call'
2013-01-29T11:20:22+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:81:in `run_callbacks'
2013-01-29T11:20:22+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.11/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
2013-01-29T11:20:22+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
2013-01-29T11:20:22+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.11/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
2013-01-29T11:20:22+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.11/lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
2013-01-29T11:20:22+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.11/lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
2013-01-29T11:20:22+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.11/lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
2013-01-29T11:20:22+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/railties-3.2.11/lib/rails/rack/logger.rb:32:in `call_app'
2013-01-29T11:20:22+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/railties-3.2.11/lib/rails/rack/logger.rb:16:in `block in call'
2013-01-29T11:20:22+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/railties-3.2.11/lib/rails/rack/logger.rb:16:in `call'
2013-01-29T11:20:22+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.11/lib/action_dispatch/middleware/request_id.rb:22:in `call'
2013-01-29T11:20:22+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.11/lib/active_support/tagged_logging.rb:22:in `tagged'
2013-01-29T11:20:22+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.11/lib/action_dispatch/middleware/static.rb:62:in `call'
2013-01-29T11:20:22+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-1.4.4/lib/rack/runtime.rb:17:in `call'
2013-01-29T11:20:22+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.11/lib/active_support/cache/strategy/local_cache.rb:72:in `call'
2013-01-29T11:20:22+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-1.4.4/lib/rack/methodoverride.rb:21:in `call'
2013-01-29T11:20:22+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:136:in `forward'
2013-01-29T11:20:22+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:51:in `call'
2013-01-29T11:20:22+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/railties-3.2.11/lib/rails/engine.rb:479:in `call'
2013-01-29T11:20:22+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/railties-3.2.11/lib/rails/application.rb:223:in `call'
2013-01-29T11:20:22+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-1.4.4/lib/rack/content_length.rb:14:in `call'
2013-01-29T11:20:22+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-1.4.4/lib/rack/handler/webrick.rb:59:in `service'
2013-01-29T11:20:22+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/railties-3.2.11/lib/rails/rack/log_tailer.rb:17:in `call'
2013-01-29T11:20:22+00:00 app[web.1]:   /usr/local/lib/ruby/1.9.1/webrick/httpserver.rb:70:in `run'
2013-01-29T11:20:22+00:00 app[web.1]:   /usr/local/lib/ruby/1.9.1/webrick/httpserver.rb:111:in `service'
2013-01-29T11:20:22+00:00 app[web.1]:   /usr/local/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread'
2013-01-29T11:20:22+00:00 app[web.1]: 
2013-01-29T11:20:22+00:00 app[web.1]: 
2013-01-29T11:20:22+00:00 app[web.1]: 
2013-01-29T11:20:22+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-1.4.4/lib/rack/lock.rb:15:in `call'
2013-01-29T11:20:22+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_specification.rb:171:in `retrieve_connection'
2013-01-29T11:20:22+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:66:in `call!'
2013-01-29T11:20:22+00:00 app[web.1]: ActiveRecord::ConnectionNotEstablished (ActiveRecord::ConnectionNotEstablished):
2013-01-29T11:20:22+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:405:in `_run__891476158821333251__call__3890590830324905565__callbacks'
2013-01-29T11:20:22+00:00 heroku[router]: at=info method=GET path=/pages/home host=vast-wave-3795.herokuapp.com fwd=83.6.123.123 dyno=web.1 queue=0 wait=0ms connect=2ms service=528ms status=500 bytes=643
2013-01-29T11:20:22+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:245:in `fetch'
2013-01-29T11:20:22+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:185:in `lookup'
4

2 回答 2

1

heroku logs从您部署的同一位置从命令提示符运行以查看发生了什么。

编辑:正如约瑟夫所说,看起来像一个数据库问题:

Connecting to database specified by DATABASE_URL失败的。

于 2013-01-28T19:58:26.713 回答
0

我猜你的应用程序使用 mysql、sqlite 等数据库。我曾经遇到过这样的问题。尝试运行heroku run rake db:schema:load。这应该将您的 schema.rb 文件加载到数据库中。这解决了我的问题

于 2013-01-29T08:11:42.307 回答