使用设计gem将rails应用程序部署到heroku

时间:2014-03-05 11:50:10

标签: ruby-on-rails heroku devise deploying


使用devise gem部署rails app到heroku,并得到错误:
应用程序错误 应用程序中发生错误,无法提供您的页面。请稍后重试。 如果您是应用程序所有者,请查看日志以获取详细信息

我做错了什么?

Gemfile

source 'https://rubygems.org'
gem 'rails', '4.0.2'
gem "devise"
group :development, :test do
  gem 'sqlite3'
end
group :production do
  gem "pg", "~> 0.17.1"
  gem "rails_12factor", "~> 0.0.2"
end
gem 'sass-rails', '~> 4.0.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 1.2'

group :doc do
  gem 'sdoc', require: false
end

heroku日志

2014-03-05T11:38:03.122304+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0
.0/gems/railties-4.0.2/lib/rails/initializable.rb:54:in `run_initializers'
2014-03-05T11:38:03.122532+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0
.0/gems/rack-1.5.2/lib/rack/builder.rb:55:in `initialize'
2014-03-05T11:38:03.122532+00:00 app[web.1]:    from /app/config.ru:in `<main>'
2014-03-05T11:38:03.122304+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0
.0/gems/railties-4.0.2/lib/rails/application.rb:215:in `initialize!'
2014-03-05T11:38:03.122532+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0
.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
2014-03-05T11:38:03.122532+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0
.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `block in
require'
2014-03-05T11:38:03.122974+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0
.0/gems/rack-1.5.2/lib/rack/builder.rb:40:in `parse_file'
2014-03-05T11:38:03.122532+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0
.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
2014-03-05T11:38:03.122974+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0
.0/gems/rack-1.5.2/lib/rack/server.rb:199:in `app'
2014-03-05T11:38:03.122974+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0
.0/gems/railties-4.0.2/lib/rails/commands/server.rb:48:in `app'
2014-03-05T11:38:03.122974+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0
.0/gems/rack-1.5.2/lib/rack/server.rb:314:in `wrapped_app'
2014-03-05T11:38:03.122304+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0
.0/gems/railties-4.0.2/lib/rails/railtie/configurable.rb:30:in `method_missing'
2014-03-05T11:38:03.122304+00:00 app[web.1]:    from /app/vendor/ruby-2.0.0/lib/
ruby/2.0.0/tsort.rb:148:in `tsort_each'
2014-03-05T11:38:03.122532+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0
.0/gems/rack-1.5.2/lib/rack/builder.rb:55:in `instance_eval'
2014-03-05T11:38:03.122974+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0
.0/gems/rack-1.5.2/lib/rack/builder.rb:49:in `eval'
2014-03-05T11:38:03.122974+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0
.0/gems/rack-1.5.2/lib/rack/builder.rb:49:in `new_from_string'
2014-03-05T11:38:03.122974+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0
.0/gems/rack-1.5.2/lib/rack/server.rb:277:in `build_app_and_options_from_config'

2014-03-05T11:38:03.122974+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0
.0/gems/railties-4.0.2/lib/rails/commands/server.rb:75:in `start'
2014-03-05T11:38:03.122974+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0
.0/gems/railties-4.0.2/lib/rails/commands.rb:76:in `block in <top (required)>'
2014-03-05T11:38:03.122532+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0
.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:214:in `load_depe
ndency'
2014-03-05T11:38:03.122532+00:00 app[web.1]:    from /app/config.ru:3:in `block
in <main>'
2014-03-05T11:38:03.122974+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0
.0/gems/railties-4.0.2/lib/rails/commands.rb:71:in `tap'
2014-03-05T11:38:03.123175+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0
.0/gems/railties-4.0.2/lib/rails/commands.rb:71:in `<top (required)>'
2014-03-05T11:38:03.123175+00:00 app[web.1]:    from bin/rails:4:in `require'
2014-03-05T11:38:03.123175+00:00 app[web.1]:    from bin/rails:4:in `<main>'
2014-03-05T11:38:03.185618+00:00 heroku[web.1]: Process exited with status 1
2014-03-05T11:38:04.513807+00:00 heroku[web.1]: Process exited with status 1
2014-03-05T11:38:04.525382+00:00 heroku[web.1]: State changed from starting to c
rashed
2014-03-05T11:38:04.526089+00:00 heroku[web.1]: State changed from crashed to st
arting
2014-03-05T11:38:07.215057+00:00 heroku[web.1]: Starting process with command `b
in/rails server -p 3478 -e production`
2014-03-05T11:38:10.026509+00:00 app[web.1]: => Run `rails server -h` for more s
tartup options
2014-03-05T11:38:10.026509+00:00 app[web.1]: => Ctrl-C to shutdown server
2014-03-05T11:38:10.026509+00:00 app[web.1]: Exiting
2014-03-05T11:38:10.026509+00:00 app[web.1]: => Booting WEBrick
2014-03-05T11:38:10.026509+00:00 app[web.1]: => Rails 4.0.2 application starting
 in production on http://0.0.0.0:3478
2014-03-05T11:38:10.028342+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/
devise-3.2.3/lib/devise/rails/routes.rb:481:in `raise_no_secret_key': Devise.sec
ret_key was not set. Please add the following to your Devise initializer: (Runti
meError)
2014-03-05T11:38:10.028342+00:00 app[web.1]:    from /app/config/routes.rb:2:in
`block in <top (required)>'
2014-03-05T11:38:10.028342+00:00 app[web.1]:
2014-03-05T11:38:10.028342+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0
.0/gems/actionpack-4.0.2/lib/action_dispatch/routing/route_set.rb:341:in `instan
ce_exec'
2014-03-05T11:38:10.028342+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0
.0/gems/actionpack-4.0.2/lib/action_dispatch/routing/route_set.rb:341:in `eval_b
lock'
2014-03-05T11:38:10.028549+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0
.0/gems/actionpack-4.0.2/lib/action_dispatch/routing/route_set.rb:319:in `draw'
2014-03-05T11:38:10.028549+00:00 app[web.1]:    from /app/config/routes.rb:1:in
`<top (required)>'
2014-03-05T11:38:10.028549+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0
.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:223:in `load'
2014-03-05T11:38:10.028549+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0
.0/gems/railties-4.0.2/lib/rails/application/routes_reloader.rb:40:in `each'
2014-03-05T11:38:10.028549+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0
.0/gems/railties-4.0.2/lib/rails/application/routes_reloader.rb:40:in `load_path
s'
2014-03-05T11:38:10.028549+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0
.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:223:in `block in
load'
2014-03-05T11:38:10.028342+00:00 app[web.1]:   config.secret_key = '67aeaf7aad0b
c86f9b392e2a42a3a5086e7d07eeedc2a6a05327ec22f82960ebf4e05086c5aa426b8f64ea9f5a51
5ecabdd821e5b29fd9e81f8818b1cff029b2'
2014-03-05T11:38:10.028549+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0
.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:223:in `load'
2014-03-05T11:38:10.028549+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0
.0/gems/railties-4.0.2/lib/rails/application/routes_reloader.rb:16:in `reload!'
2014-03-05T11:38:10.028342+00:00 app[web.1]:
2014-03-05T11:38:10.028731+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0
.0/gems/activesupport-4.0.2/lib/active_support/lazy_load_hooks.rb:36:in `call'
2014-03-05T11:38:10.028731+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0
.0/gems/activesupport-4.0.2/lib/active_support/lazy_load_hooks.rb:36:in `execute
_hook'
2014-03-05T11:38:10.028731+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0
.0/gems/activesupport-4.0.2/lib/active_support/lazy_load_hooks.rb:44:in `run_loa
d_hooks'
2014-03-05T11:38:10.028731+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0
.0/gems/devise-3.2.3/lib/devise/rails.rb:14:in `block in <class:Engine>'
2014-03-05T11:38:10.028731+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0
.0/gems/railties-4.0.2/lib/rails/application.rb:102:in `reload_routes!'
2014-03-05T11:38:10.028731+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0
.0/gems/activesupport-4.0.2/lib/active_support/lazy_load_hooks.rb:45:in `block i
n run_load_hooks'
2014-03-05T11:38:10.028731+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0
.0/gems/activesupport-4.0.2/lib/active_support/lazy_load_hooks.rb:44:in `each'
2014-03-05T11:38:10.028342+00:00 app[web.1]: Please ensure you restarted your ap
plication after installing Devise or setting the key.
2014-03-05T11:38:10.028731+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0
.0/gems/railties-4.0.2/lib/rails/application/finisher.rb:55:in `block in <module
:Finisher>'
2014-03-05T11:38:10.028549+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0
.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:214:in `load_depe
ndency'
2014-03-05T11:38:10.028731+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0
.0/gems/railties-4.0.2/lib/rails/initializable.rb:30:in `run'
2014-03-05T11:38:10.029264+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0
.0/gems/railties-4.0.2/lib/rails/initializable.rb:55:in `block in run_initialize
rs'
2014-03-05T11:38:10.028731+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0
.0/gems/railties-4.0.2/lib/rails/initializable.rb:30:in `instance_exec'
2014-03-05T11:38:10.029264+00:00 app[web.1]:    from /app/vendor/ruby-2.0.0/lib/
ruby/2.0.0/tsort.rb:150:in `block in tsort_each'
2014-03-05T11:38:10.029264+00:00 app[web.1]:    from /app/vendor/ruby-2.0.0/lib/
ruby/2.0.0/tsort.rb:183:in `block (2 levels) in each_strongly_connected_componen
t'
2014-03-05T11:38:10.029264+00:00 app[web.1]:    from /app/vendor/ruby-2.0.0/lib/
ruby/2.0.0/tsort.rb:219:in `each_strongly_connected_component_from'
2014-03-05T11:38:10.028342+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0
.0/gems/devise-3.2.3/lib/devise/rails/routes.rb:206:in `devise_for'
2014-03-05T11:38:10.029264+00:00 app[web.1]:    from /app/vendor/ruby-2.0.0/lib/
ruby/2.0.0/tsort.rb:182:in `block in each_strongly_connected_component'
2014-03-05T11:38:10.028549+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0
.0/gems/railties-4.0.2/lib/rails/application/routes_reloader.rb:40:in `block in
load_paths'
2014-03-05T11:38:10.029264+00:00 app[web.1]:    from /app/vendor/ruby-2.0.0/lib/
ruby/2.0.0/tsort.rb:180:in `each_strongly_connected_component'
2014-03-05T11:38:10.029264+00:00 app[web.1]:    from /app/vendor/ruby-2.0.0/lib/
ruby/2.0.0/tsort.rb:148:in `tsort_each'
2014-03-05T11:38:10.029264+00:00 app[web.1]:    from /app/vendor/ruby-2.0.0/lib/
ruby/2.0.0/tsort.rb:180:in `each'
2014-03-05T11:38:10.029504+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0
.0/gems/railties-4.0.2/lib/rails/railtie/configurable.rb:30:in `method_missing'
2014-03-05T11:38:10.029264+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0
.0/gems/railties-4.0.2/lib/rails/initializable.rb:54:in `run_initializers'
2014-03-05T11:38:10.029504+00:00 app[web.1]:    from /app/config/environment.rb:
5:in `<top (required)>'
2014-03-05T11:38:10.029264+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0
.0/gems/railties-4.0.2/lib/rails/application.rb:215:in `initialize!'
2014-03-05T11:38:10.029504+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0
.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
2014-03-05T11:38:10.029504+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0
.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:214:in `load_depe
ndency'
2014-03-05T11:38:10.029504+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0
.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `block in
require'
2014-03-05T11:38:10.029504+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0
.0/gems/rack-1.5.2/lib/rack/builder.rb:55:in `initialize'
2014-03-05T11:38:10.029504+00:00 app[web.1]:    from /app/config.ru:3:in `block
in <main>'
2014-03-05T11:38:10.029504+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0
.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
2014-03-05T11:38:10.029504+00:00 app[web.1]:    from /app/config.ru:in `new'
2014-03-05T11:38:10.029504+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0
.0/gems/rack-1.5.2/lib/rack/builder.rb:55:in `instance_eval'
2014-03-05T11:38:10.029882+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0
.0/gems/rack-1.5.2/lib/rack/builder.rb:49:in `eval'
2014-03-05T11:38:10.029882+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0
.0/gems/rack-1.5.2/lib/rack/builder.rb:49:in `new_from_string'
2014-03-05T11:38:10.029882+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0
.0/gems/rack-1.5.2/lib/rack/server.rb:277:in `build_app_and_options_from_config'

2014-03-05T11:38:10.029882+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0
.0/gems/rack-1.5.2/lib/rack/server.rb:199:in `app'
2014-03-05T11:38:10.029882+00:00 app[web.1]:    from /app/config.ru:in `<main>'
2014-03-05T11:38:10.029882+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0
.0/gems/rack-1.5.2/lib/rack/builder.rb:40:in `parse_file'
2014-03-05T11:38:10.030085+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0
.0/gems/railties-4.0.2/lib/rails/commands.rb:71:in `tap'
2014-03-05T11:38:10.029882+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0
.0/gems/railties-4.0.2/lib/rails/commands/server.rb:75:in `start'
2014-03-05T11:38:10.030085+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0
.0/gems/railties-4.0.2/lib/rails/commands.rb:71:in `<top (required)>'
2014-03-05T11:38:10.029882+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0
.0/gems/rack-1.5.2/lib/rack/server.rb:314:in `wrapped_app'
2014-03-05T11:38:10.030085+00:00 app[web.1]:    from bin/rails:4:in `require'
2014-03-05T11:38:10.030085+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0
.0/gems/railties-4.0.2/lib/rails/commands.rb:76:in `block in <top (required)>'
2014-03-05T11:38:10.029882+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0
.0/gems/railties-4.0.2/lib/rails/commands/server.rb:48:in `app'
2014-03-05T11:38:10.030085+00:00 app[web.1]:    from bin/rails:4:in `<main>'
2014-03-05T11:38:11.292848+00:00 heroku[web.1]: Process exited with status 1
2014-03-05T11:38:11.305392+00:00 heroku[web.1]: State changed from starting to c
rashed
2014-03-05T11:38:11.762244+00:00 heroku[router]: at=error code=H10 desc="App cra
shed" method=GET path=/ host=floating-dusk-9542.herokuapp.com request_id=8f2b383
1-6bbb-4724-ba15-173b1fe54b96 fwd="77.121.6.163" dyno= connect= service= status=
503 bytes=

1 个答案:

答案 0 :(得分:3)

它说:

Devise.secret_key was not set. Please add the following to your Devise initializer: (Runti
meError)

这意味着您没有设置正确的config/initializers/devise.rb。根据{{​​3}},我会这样做:

rails generate devise:install