2012-04-05 90 views
1

我创建了示例rails应用程序并部署到heroku中。 Rails版本是3.1.3 Ruby版本1.8.7-p352,Ruby gem版本是1.8.21。heroku中的应用程序错误

在将Rails推送到Heroku后,当我点击heroku URL时,会显示网页中的以下错误消息。应用程序中发生

应用程序错误

错误,你 页面无法送达。请稍后重试。

如果您是应用程序所有者,请查看您的日志以了解详细信息。

我检查我的日志在终端显示错误如下:

2012-04-05T05:08:36+00:00 app[web.1]: from /home/heroku_rack/heroku.ru:11:in `block in <main>' 
2012-04-05T05:08:36+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/rack-1.3.6/lib/rack/builder.rb:51:in `instance_eval' 
2012-04-05T05:08:36+00:00 app[web.1]: from /home/heroku_rack/heroku.ru:1:in `new' 
2012-04-05T05:08:36+00:00 app[web.1]: from /home/heroku_rack/heroku.ru:1:in `<main>' 
2012-04-05T05:08:36+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/rack-1.3.6/lib/rack/builder.rb:51:in `initialize' 
2012-04-05T05:08:36+00:00 app[web.1]: from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/thin-1.2.6/lib/rack/adapter/loader.rb:36:in `eval' 
2012-04-05T05:08:36+00:00 app[web.1]: from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/thin-1.2.6/lib/rack/adapter/loader.rb:36:in `load' 
2012-04-05T05:08:36+00:00 app[web.1]: from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/thin-1.2.6/lib/thin/controllers/controller.rb:175:in `load_rackup_config' 
2012-04-05T05:08:36+00:00 app[web.1]: from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/thin-1.2.6/lib/thin/runner.rb:177:in `run_command' 
2012-04-05T05:08:36+00:00 app[web.1]: from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/thin-1.2.6/lib/thin/controllers/controller.rb:65:in `start' 
2012-04-05T05:08:36+00:00 app[web.1]: from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/thin-1.2.6/lib/thin/runner.rb:143:in `run!' 
2012-04-05T05:08:36+00:00 app[web.1]: from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/thin-1.2.6/bin/thin:6:in `<top (required)>' 
2012-04-05T05:08:36+00:00 app[web.1]: from /usr/ruby1.9.2/bin/thin:19:in `load' 
2012-04-05T05:08:36+00:00 app[web.1]: from /usr/ruby1.9.2/bin/thin:19:in `<main>' 
2012-04-05T05:08:37+00:00 heroku[web.1]: Process exited with status 1 
2012-04-05T05:08:37+00:00 heroku[web.1]: State changed from starting to crashed 
2012-04-05T05:19:58+00:00 heroku[web.1]: State changed from crashed to created 
2012-04-05T05:19:58+00:00 heroku[web.1]: State changed from created to starting 
2012-04-05T05:20:02+00:00 heroku[web.1]: Starting process with command `thin -p 13221 -e production -R /home/heroku_rack/heroku.ru start` 
2012-04-05T05:20:06+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/activerecord-3.1.3/lib/active_record/connection_adapters/abstract/connection_specification.rb:71:in `rescue in establish_connection': Please install the postgresql adapter: `gem install activerecord-postgresql-adapter` (pg is not part of the bundle. Add it to Gemfile.) (RuntimeError) 
2012-04-05T05:20:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/activerecord-3.1.3/lib/active_record/connection_adapters/abstract/connection_specification.rb:68:in `establish_connection' 
2012-04-05T05:20:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/activerecord-3.1.3/lib/active_record/connection_adapters/abstract/connection_specification.rb:60:in `establish_connection' 
2012-04-05T05:20:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/activerecord-3.1.3/lib/active_record/connection_adapters/abstract/connection_specification.rb:55:in `establish_connection' 
2012-04-05T05:20:06+00:00 app[web.1]: from /app/.bundle/gems/rub 
y/1.9.1/gems/activerecord-3.1.3/lib/active_record/railtie.rb:69:in `block (2 levels) in <class:Railtie>' 
2012-04-05T05:20:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/lazy_load_hooks.rb:43:in `block in run_load_hooks' 
2012-04-05T05:20:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/lazy_load_hooks.rb:42:in `each' 
2012-04-05T05:20:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/lazy_load_hooks.rb:36:in `instance_eval' 
2012-04-05T05:20:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook' 
2012-04-05T05:20:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/lazy_load_hooks.rb:42:in `run_load_hooks' 
2012-04-05T05:20:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/activerecord-3.1.3/lib/active_record/base.rb:2190:in `<top (required)>' 
2012-04-05T05:20:06+00:00 app[web.1]: from /app/app/models/product.rb:1:in `<top (required)>' 
2012-04-05T05:20:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `require' 
2012-04-05T05:20:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `block in require' 
2012-04-05T05:20:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `require' 
2012-04-05T05:20:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:225:in `load_dependency' 
2012-04-05T05:20:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:348:in `require_or_load' 
2012-04-05T05:20:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:181:in `block in const_missing' 
2012-04-05T05:20:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:489:in `load_missing_constant' 
2012-04-05T05:20:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:179:in `each' 
2012-04-05T05:20:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/inflector/methods.rb:123:in `each' 
2012-04-05T05:20:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/inflector/methods.rb:123:in `constantize' 
2012-04-05T05:20:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:179:in `const_missing' 
2012-04-05T05:20:06+00:00 app[web.1]: 
    from /app/.bundle/gems/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/inflector/methods.rb:124:in `block in constantize' 
2012-04-05T05:20:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/core_ext/string/inflections.rb:43:in `constantize' 
2012-04-05T05:20:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/actionpack-3.1.3/lib/action_controller/metal/params_wrapper.rb:128:in `inherited' 
2012-04-05T05:20:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/actionpack-3.1.3/lib/abstract_controller/railties/routes_helpers.rb:7:in `block (2 levels) in with' 
2012-04-05T05:20:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/actionpack-3.1.3/lib/action_controller/metal/params_wrapper.rb:167:in `_set_wrapper_defaults' 
2012-04-05T05:20:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/actionpack-3.1.3/lib/action_controller/metal/params_wrapper.rb:148:in `_default_wrap_model' 
2012-04-05T05:20:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/actionpack-3.1.3/lib/action_controller/railties/paths.rb:7:in `block (2 levels) in with' 
2012-04-05T05:20:06+00:00 app[web.1]: from /app/app/controllers/products_controller.rb:1:in `<top (required)>' 
2012-04-05T05:20:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `require' 
2012-04-05T05:20:06+00:00 app[web.1]: f 
rom /app/.bundle/gems/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `block in require' 
2012-04-05T05:20:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:225:in `load_dependency' 
2012-04-05T05:20:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `require' 
2012-04-05T05:20:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:348:in `require_or_load' 
2012-04-05T05:20:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:302:in `depend_on' 
2012-04-05T05:20:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:214:in `require_dependency' 
2012-04-05T05:20:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/railties-3.1.3/lib/rails/engine.rb:417:in `block (2 levels) in eager_load!' 
2012-04-05T05:20:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/railties-3.1.3/lib/rails/engine.rb:416:in `each' 
2012-04-05T05:20:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/railties-3.1.3/lib/rails/engine.rb:416:in `block in eager_load!' 
2012-04-05T05:20:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/railties-3.1.3/lib/rails/engine.rb:414:in `each' 
2012-04-05T05:20:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/railties-3.1.3/lib/rails/engine.rb:414:in `eager_load!' 
2012-04-05T05:20:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/railties-3.1.3/lib/rails/initializable.rb:30:in `instance_exec' 
2012-04-05T05:20:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/railties-3.1.3/lib/rails/application/finisher.rb:51:in `block in <module:Finisher>' 
2012-04-05T05:20:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/railties-3.1.3/lib/rails/initializable.rb:30:in `run' 
2012-04-05T05:20:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/railties-3.1.3/lib/rails/initializable.rb:55:in `block in run_initializers' 
2012-04-05T05:20:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/railties-3.1.3/lib/rails/initializable.rb:54:in `each' 
2012-04-05T05:20:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/railties-3.1.3/lib/rails/initializable.rb:54:in `run_initializers' 
2012-04-05T05:20:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/railties-3.1.3/lib/rails/application.rb:96:in `initialize!' 
2012-04-05T05:20:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/railties-3.1.3/lib/rails/railtie/configurable.rb:30:in `method_missing' 
2012-04-05T05:20:06+00:00 app[web.1]: from /app/config/environment.rb:5:in `<top (required)>' 
2012-04-05T05:20:06+00:00 app[web.1]: from <internal:lib/rubygems/custom_require>:29:in `require' 
2012-04-05T05:20:06+00:00 app[web.1]: from <internal:lib/rubygems/custom_require>:29:in `require' 
2012-04-05T05:20:06+00:00 app[web.1]: from config.ru:3:in `block (3 levels) in <main>' 
2012-04-05T05:20:06+00:00 app[web.1]: from /home/heroku_rack/heroku.ru:23:in `block (3 levels) in <main>' 
2012-04-05T05:20:06+00:00 app[web.1]: from /home/heroku_rack/heroku.ru:23:in `eval' 
2012-04-05T05:20:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/rack-1.3.6/lib/rack/builder.rb:51:in `instance_eval' 
2012-04-05T05:20:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/rack-1.3.6/lib/rack/builder.rb:51:in `initialize' 
2012-04-05T05:20:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/rack-1.3.6/lib/rack/builder.rb:120:in `new' 
2012-04-05T05:20:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/rack-1.3.6/lib/rack/builder.rb:120:in `map' 
2012-04-05T05:20:06+00:00 app[web.1]: from /home/heroku_rack/heroku.ru:18:in `block (2 levels) in <main>' 
2012-04-05T05:20:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/rack-1.3.6/lib/rack/builder.rb:51:in `instance_eval' 
2012-04-05T05:20:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/rack-1.3.6/lib/rack/builder.rb:51:in `initialize' 
2012-04-05T05:20:06+00:00 app[web.1]: from /home/heroku_rack/heroku.ru:11:in `new' 
2012-04-05T05:20:06+00:00 app[web.1]: from /home/heroku_rack/heroku.ru:11:in `block in <main>' 
2012-04-05T05:20:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/rack-1.3.6/lib/rack/builder.rb:51:in `instance_eval' 
2012-04-05T05:20:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/rack-1.3.6/lib/rack/builder.rb:51:in `initialize' 
2012-04-05T05:20:06+00:00 app[web.1]: from /home/heroku_rack/heroku.ru:1:in `new' 
2012-04-05T05:20:06+00:00 app[web.1]: from /home/heroku_rack/heroku.ru:1:in `<main>' 
2012-04-05T05:20:06+00:00 app[web.1]: from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/thin-1.2.6/lib/rack/adapter/loader.rb:36:in `eval' 
2012-04-05T05:20:06+00:00 app[web.1]: from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/thin-1.2.6/lib/rack/adapter/loader.rb:36:in `load' 
2012-04-05T05:20:06+00:00 app[web.1]: from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/thin-1.2.6/lib/thin/controllers/controller.rb:175:in `load_rackup_config' 
2012-04-05T05:20:06+00:00 app[web.1]: from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/thin-1.2.6/lib/thin/controllers/controller.rb:65:in `start' 
2012-04-05T05:20:06+00:00 app[web.1]: from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/thin-1.2.6/lib/thin/runner.rb:177:in `run_command' 
2012-04-05T05:20:06+00:00 app[web.1]: from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/thin-1.2.6/lib/thin/runner.rb:143:in `run!' 
2012-04-05T05:20:06+00:00 app[web.1]: from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/thin-1.2.6/bin/thin:6:in `<top (required)>' 
2012-04-05T05:20:06+00:00 app[web.1]: from /usr/ruby1.9.2/bin/thin:19:in `load' 
2012-04-05T05:20:06+00:00 app[web.1]: from /usr/ruby1.9.2/bin/thin:19:in `<main>' 
2012-04-05T05:20:08+00:00 heroku[web.1]: Process exited with status 1 
2012-04-05T05:20:08+00:00 heroku[web.1]: State changed from starting to crashed 

我使用的MySQL数据库。我可以使用Mysql数据库运行rails应用程序吗?如何解决这个问题?

回答

0

的Heroku的PostgreSQL提供开箱即用,因此对pg宝石的错误。你有两个选择。

  1. 要么调整你的应用程序中使用PostgreSQL的,这不应该是难,如果您使用的是ORM如ActiveRecord的,并假设你不使用自定义的SQL,或

  2. 翻转使用其中一个MySQL附加组件,如ClearDBAmazon RDS

+0

你如何“调整你的应用程序”来使用postgresql?只需将gem for postgresql添加到gemfile中的生产中? – Laser 2012-05-22 16:56:04

+0

非常漂亮 - 如果您使用的是Heroku供应的数据库,请翻转至pg'宝石,其余部分应由Heroku完成 – 2012-05-23 08:16:36

0

你缺少的姿势宝石在你的Gemfile

gem "pg" 

是你所需要的

+0

我使用mysql数据库,那么为什么我把皮克宝石 – visnu 2012-04-05 06:30:06

+0

Heroku的默认提供的Postgres数据库 - 你需要使用MySQL插件,如果你想使用MySQL在Heroku或使用您自己。 – 2012-04-05 06:38:29

+0

heroku.how中没有MySQL插件来获取MySQL插件? – visnu 2012-04-05 08:21:32