0

我是 Ruby on rails 的新手,我正在尝试在 Heroku 上部署一个应用程序。当我推送到 Heroku 时,一切似乎都很好,但是当我到达应用程序 url 时出现应用程序错误。

这是我的 Heroku 日志的样子:



    2013-05-20T13:49:15.073640+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/lazy_load_hooks.rb:26:in `block in on_load'
    2013-05-20T13:49:15.073640+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/lazy_load_hooks.rb:25:in `each'
    2013-05-20T13:49:15.073640+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/lazy_load_hooks.rb:25:in `on_load'
    2013-05-20T13:49:15.073640+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/railtie.rb:74:in `block in '
    2013-05-20T13:49:15.073640+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/initializable.rb:30:in `instance_exec'
    2013-05-20T13:49:15.074065+00:00 app[web.1]:    from /app/config/environment.rb:5:in `'
    2013-05-20T13:49:15.074065+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `require'
    2013-05-20T13:49:15.074065+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `block in require'
    2013-05-20T13:49:15.074065+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:236:in `load_dependency'
    2013-05-20T13:49:15.073640+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/initializable.rb:30:in `run'
    2013-05-20T13:49:15.074065+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/initializable.rb:54:in `each'
    2013-05-20T13:49:15.073640+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/initializable.rb:55:in `block in run_initializers'
    2013-05-20T13:49:15.074065+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/initializable.rb:54:in `run_initializers'
    2013-05-20T13:49:15.074065+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/application.rb:136:in `initialize!'
    2013-05-20T13:49:15.074065+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/railtie/configurable.rb:30:in `method_missing'
    2013-05-20T13:49:15.074065+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `require'
    2013-05-20T13:49:15.074065+00:00 app[web.1]:    from /app/config.ru:3:in `block in '
    2013-05-20T13:49:15.074390+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:51:in `instance_eval'
    2013-05-20T13:49:15.074390+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:51:in `initialize'
    2013-05-20T13:49:15.074390+00:00 app[web.1]:    from /app/config.ru:in `new'
    2013-05-20T13:49:15.074390+00:00 app[web.1]:    from /app/config.ru:in `'
    2013-05-20T13:49:15.074390+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:40:in `eval'
    2013-05-20T13:49:15.074390+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:40:in `parse_file'
    2013-05-20T13:49:15.074390+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/server.rb:200:in `app'
    2013-05-20T13:49:15.074390+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/commands/server.rb:46:in `app'
    2013-05-20T13:49:15.074390+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/server.rb:304:in `wrapped_app'
    2013-05-20T13:49:15.074390+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/server.rb:254:in `start'
    2013-05-20T13:49:15.074803+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/commands/server.rb:70:in `start'
    2013-05-20T13:49:15.074803+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/commands.rb:55:in `block in '
    2013-05-20T13:49:15.074803+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/commands.rb:50:in `tap'
    2013-05-20T13:49:15.074803+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/commands.rb:50:in `'
    2013-05-20T13:49:15.074803+00:00 app[web.1]:    from script/rails:6:in `require'
    2013-05-20T13:49:15.074803+00:00 app[web.1]:    from script/rails:6:in `'
    2013-05-20T13:49:15.089298+00:00 app[web.1]: => Booting WEBrick
    2013-05-20T13:49:15.089298+00:00 app[web.1]: => Rails 3.2.6 application starting in production on http://0.0.0.0:50998
    2013-05-20T13:49:15.089298+00:00 app[web.1]: => Call with -d to detach
    2013-05-20T13:49:15.089298+00:00 app[web.1]: => Ctrl-C to shutdown server
    2013-05-20T13:49:15.089298+00:00 app[web.1]: Exiting
    2013-05-20T13:49:16.330532+00:00 heroku[web.1]: Process exited with status 1
    2013-05-20T13:49:16.355538+00:00 heroku[web.1]: State changed from starting to crashed
    2013-05-20T13:49:16.356596+00:00 heroku[web.1]: State changed from crashed to starting
    2013-05-20T13:49:18.080130+00:00 heroku[web.1]: Starting process with command `bundle exec rails server -p 43857`
    2013-05-20T13:49:22.261433+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  at /app/config/environment.rb:5)
    2013-05-20T13:49:22.261568+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  at /app/config/environment.rb:5)
    2013-05-20T13:49:23.392694+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `block in require'
    2013-05-20T13:49:23.392617+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `require'
    2013-05-20T13:49:23.392872+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `require'
    2013-05-20T13:49:23.392768+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:236:in `load_dependency'
    2013-05-20T13:49:23.392320+00:00 app[web.1]: /app/vendor/bundle/ruby/1.9.1/gems/bundler-1.3.2/lib/bundler/rubygems_integration.rb:214:in `block in replace_gem': Please install the postgresql adapter: `gem install activerecord-postgresql-adapter` (pg is not part of the bundle. Add it to Gemfile.) (LoadError)
    2013-05-20T13:49:23.393040+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_specification.rb:39:in `resolve_string_connection'
    2013-05-20T13:49:23.392537+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/postgresql_adapter.rb:7:in `'
    2013-05-20T13:49:23.393425+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
    2013-05-20T13:49:23.392964+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_specification.rb:48:in `resolve_hash_connection'
    2013-05-20T13:49:23.393190+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_specification.rb:127:in `establish_connection'
    2013-05-20T13:49:23.393572+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/lazy_load_hooks.rb:25:in `each'
    2013-05-20T13:49:23.393264+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/railtie.rb:82:in `block (2 levels) in '
    2013-05-20T13:49:23.393116+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_specification.rb:25:in `spec'
    2013-05-20T13:49:23.393754+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/railtie.rb:74:in `block in '
    2013-05-20T13:49:23.393498+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/lazy_load_hooks.rb:26:in `block in on_load'
    2013-05-20T13:49:23.393350+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/lazy_load_hooks.rb:36:in `instance_eval'
    2013-05-20T13:49:23.393827+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/initializable.rb:30:in `instance_exec'
    2013-05-20T13:49:23.393672+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/lazy_load_hooks.rb:25:in `on_load'
    2013-05-20T13:49:23.394048+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/initializable.rb:54:in `each'
    2013-05-20T13:49:23.393901+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/initializable.rb:30:in `run'
    2013-05-20T13:49:23.393974+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/initializable.rb:55:in `block in run_initializers'
    2013-05-20T13:49:23.394373+00:00 app[web.1]:    from /app/config/environment.rb:5:in `'
    2013-05-20T13:49:23.394208+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/application.rb:136:in `initialize!'
    2013-05-20T13:49:23.394471+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `require'
    2013-05-20T13:49:23.394557+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `block in require'
    2013-05-20T13:49:23.394633+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:236:in `load_dependency'
    2013-05-20T13:49:23.394720+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `require'
    2013-05-20T13:49:23.394298+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/railtie/configurable.rb:30:in `method_missing'
    2013-05-20T13:49:23.394121+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/initializable.rb:54:in `run_initializers'
    2013-05-20T13:49:23.395088+00:00 app[web.1]:    from /app/config.ru:in `'
    2013-05-20T13:49:23.395345+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/server.rb:200:in `app'
    2013-05-20T13:49:23.394794+00:00 app[web.1]:    from /app/config.ru:3:in `block in '
    2013-05-20T13:49:23.394941+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:51:in `initialize'
    2013-05-20T13:49:23.395713+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/commands.rb:55:in `block in '
    2013-05-20T13:49:23.395950+00:00 app[web.1]:    from script/rails:6:in `require'
    2013-05-20T13:49:23.395258+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:40:in `parse_file'
    2013-05-20T13:49:23.395566+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/server.rb:254:in `start'
    2013-05-20T13:49:23.395420+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/commands/server.rb:46:in `app'
    2013-05-20T13:49:23.395639+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/commands/server.rb:70:in `start'
    2013-05-20T13:49:23.394868+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:51:in `instance_eval'
    2013-05-20T13:49:23.395161+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:40:in `eval'
    2013-05-20T13:49:23.395014+00:00 app[web.1]:    from /app/config.ru:in `new'
    2013-05-20T13:49:23.395493+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/server.rb:304:in `wrapped_app'
    2013-05-20T13:49:23.395875+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/commands.rb:50:in `'
    2013-05-20T13:49:23.395789+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/commands.rb:50:in `tap'
    2013-05-20T13:49:23.396043+00:00 app[web.1]:    from script/rails:6:in `'
    2013-05-20T13:49:23.411001+00:00 app[web.1]: Exiting
    2013-05-20T13:49:23.411001+00:00 app[web.1]: => Booting WEBrick
    2013-05-20T13:49:23.411001+00:00 app[web.1]: => Rails 3.2.6 application starting in production on http://0.0.0.0:43857
    2013-05-20T13:49:23.411001+00:00 app[web.1]: => Ctrl-C to shutdown server
    2013-05-20T13:49:23.411001+00:00 app[web.1]: => Call with -d to detach
    2013-05-20T13:49:24.585497+00:00 heroku[web.1]: Process exited with status 1
    2013-05-20T13:49:24.590440+00:00 heroku[web.1]: State changed from starting to crashed
    2013-05-20T13:50:26.255733+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=fast-tundra-4554.herokuapp.com fwd="84.65.221.192" dyno= connect= service= status=503 bytes=
    2013-05-20T13:50:27.840833+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/favicon.ico host=fast-tundra-4554.herokuapp.com fwd="84.65.221.192" dyno= connect= service= status=503 bytes=
    2013-05-20T13:50:28.281774+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/favicon.ico host=fast-tundra-4554.herokuapp.com fwd="84.65.221.192" dyno= connect= service= status=503 bytes=
    2013-05-20T13:50:55.681139+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/users/sign_in host=fast-tundra-4554.herokuapp.com fwd="84.65.221.192" dyno= connect= service= status=503 bytes=

我不明白出了什么问题。

4

1 回答 1

0

1)您需要将“pg”添加到您Gemfile的推送heroku并连接到那里的postgres数据库

gem 'pg'

2)你需要根据你的环境运行

rake assets:precompile RAILS_ENV=production

3) 将此 gem 添加到您的 Gemfile

group :assets do
  gem 'therubyracer'
  gem 'sass-rails', "  ~> 3.1.0"
  gem 'coffee-rails', "~> 3.1.0"
  gem 'uglifier'
end

然后运行

bundle install
于 2017-07-22T07:59:46.380 回答