简体   繁体   English

尝试将Rails应用程序部署到Heroku-应用程序错误?

[英]Attempting to deploy Rails app to Heroku - Application Error?

I'm not sure why this is happening. 我不确定为什么会这样。 I tried heroku restart and running herok run rake db:migrate as suggested by another SO thread, but it didn't work. 我尝试了heroku restart并按照另一个SO线程的建议运行herok run rake db:migrate ,但是没有用。

Just to clarify, my application works fine on localhost. 为了澄清起见,我的应用程序在localhost上运行良好。

HEROKU LOGS: HEROKU日志:

2014-03-23T21:07:47.989154+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-23T21:07:47.989154+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-23T21:07:47.989709+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-23T21:07:47.989883+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.3/lib/rails/commands/server.rb:48:in `app'
2014-03-23T21:07:47.989883+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-23T21:07:47.989709+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-23T21:07:47.989883+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-23T21:07:47.989883+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-23T21:07:47.989883+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.3/lib/rails/commands.rb:71:in `tap'
2014-03-23T21:07:47.989709+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-23T21:07:47.989883+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.3/lib/rails/commands.rb:71:in `<top (required)>'
2014-03-23T21:07:47.989883+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.3/lib/rails/commands.rb:76:in `block in <top (required)>'
2014-03-23T21:07:47.989883+00:00 app[web.1]:    from bin/rails:4:in `require'
2014-03-23T21:07:47.990048+00:00 app[web.1]:    from bin/rails:4:in `<main>'
2014-03-23T21:07:49.415499+00:00 heroku[web.1]: Process exited with status 1
2014-03-23T21:07:49.431611+00:00 heroku[web.1]: State changed from starting to crashed
2014-03-23T21:07:49.431611+00:00 heroku[web.1]: State changed from crashed to starting
2014-03-23T21:07:54.457611+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 51763 -e production`
2014-03-23T21:08:04.929404+00:00 app[web.1]: => Booting WEBrick
2014-03-23T21:08:04.929404+00:00 app[web.1]: => Run `rails server -h` for more startup options
2014-03-23T21:08:04.934429+00:00 app[web.1]: 
2014-03-23T21:08:04.929404+00:00 app[web.1]: => Ctrl-C to shutdown server
2014-03-23T21:08:04.929404+00:00 app[web.1]: Exiting
2014-03-23T21:08:04.934429+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.secret_key was not set. Please add the following to your Devise initializer: (RuntimeError)
2014-03-23T21:08:04.934429+00:00 app[web.1]: 
2014-03-23T21:08:04.934429+00:00 app[web.1]:   config.secret_key = '0964de5caa044bc2ff80ae8c6a0f635d8088b348014048dd7a822e5156b4abb76e6a67d2ad2b3a77ec34221815146e3ce8c09822ec3058af44f6c85ae53073e0'
2014-03-23T21:08:04.934429+00:00 app[web.1]: Please ensure you restarted your application after installing Devise or setting the key.
2014-03-23T21:08:04.929404+00:00 app[web.1]: => Rails 4.0.3 application starting in production on http://0.0.0.0:51763
2014-03-23T21:08:04.934429+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.3/lib/action_dispatch/routing/route_set.rb:341:in `instance_exec'
2014-03-23T21:08:04.934429+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.3/lib/action_dispatch/routing/route_set.rb:341:in `eval_block'
2014-03-23T21:08:04.934429+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.3/lib/action_dispatch/routing/route_set.rb:319:in `draw'
2014-03-23T21:08:04.934783+00:00 app[web.1]:    from /app/config/routes.rb:1:in `<top (required)>'
2014-03-23T21:08:04.934783+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.3/lib/active_support/dependencies.rb:223:in `load'
2014-03-23T21:08:04.934429+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-23T21:08:04.934429+00:00 app[web.1]:    from /app/config/routes.rb:2:in `block in <top (required)>'
2014-03-23T21:08:04.934783+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.3/lib/rails/application/routes_reloader.rb:40:in `each'
2014-03-23T21:08:04.934783+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.3/lib/rails/application/routes_reloader.rb:40:in `load_paths'
2014-03-23T21:08:04.934783+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.3/lib/rails/application/routes_reloader.rb:16:in `reload!'
2014-03-23T21:08:04.934783+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.3/lib/rails/application.rb:102:in `reload_routes!'
2014-03-23T21:08:04.935072+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-23T21:08:04.934783+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.3/lib/active_support/dependencies.rb:223:in `load'
2014-03-23T21:08:04.935072+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.3/lib/active_support/lazy_load_hooks.rb:44:in `each'
2014-03-23T21:08:04.934783+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.3/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
2014-03-23T21:08:04.934783+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.3/lib/active_support/dependencies.rb:214:in `load_dependency'
2014-03-23T21:08:04.935072+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.3/lib/active_support/lazy_load_hooks.rb:44:in `run_load_hooks'
2014-03-23T21:08:04.935072+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.3/lib/rails/application/finisher.rb:55:in `block in <module:Finisher>'
2014-03-23T21:08:04.935072+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.3/lib/rails/initializable.rb:30:in `instance_exec'
2014-03-23T21:08:04.935788+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-23T21:08:04.935072+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.3/lib/active_support/lazy_load_hooks.rb:45:in `block in run_load_hooks'
2014-03-23T21:08:04.935072+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.3/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
2014-03-23T21:08:04.935788+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-23T21:08:04.935788+00:00 app[web.1]:    from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:180:in `each'
2014-03-23T21:08:04.935788+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-23T21:08:04.935788+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-23T21:08:04.935788+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.3/lib/rails/initializable.rb:54:in `run_initializers'
2014-03-23T21:08:04.935788+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_component'
2014-03-23T21:08:04.935788+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-23T21:08:04.935072+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.3/lib/rails/initializable.rb:55:in `block in run_initializers'
2014-03-23T21:08:04.936062+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.3/lib/active_support/dependencies.rb:229:in `require'
2014-03-23T21:08:04.936062+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.3/lib/active_support/dependencies.rb:214:in `load_dependency'
2014-03-23T21:08:04.936062+00:00 app[web.1]:    from /app/config.ru:3:in `block in <main>'
2014-03-23T21:08:04.936062+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-23T21:08:04.936062+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-23T21:08:04.935788+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.3/lib/rails/railtie/configurable.rb:30:in `method_missing'
2014-03-23T21:08:04.936062+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.3/lib/active_support/dependencies.rb:229:in `block in require'
2014-03-23T21:08:04.936062+00:00 app[web.1]:    from /app/config/environment.rb:5:in `<top (required)>'
2014-03-23T21:08:04.936062+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.3/lib/active_support/dependencies.rb:229:in `require'
2014-03-23T21:08:04.937179+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-23T21:08:04.937179+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-23T21:08:04.937179+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-23T21:08:04.937179+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-23T21:08:04.937179+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.3/lib/rails/commands/server.rb:48:in `app'
2014-03-23T21:08:04.937179+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.3/lib/rails/commands/server.rb:75:in `start'
2014-03-23T21:08:04.936062+00:00 app[web.1]:    from /app/config.ru:in `<main>'
2014-03-23T21:08:04.937179+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-23T21:08:04.937179+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-23T21:08:04.934783+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.3/lib/active_support/dependencies.rb:223:in `block in load'
2014-03-23T21:08:04.938108+00:00 app[web.1]:    from bin/rails:4:in `require'
2014-03-23T21:08:04.938108+00:00 app[web.1]:    from bin/rails:4:in `<main>'
2014-03-23T21:08:04.937179+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.3/lib/rails/commands.rb:71:in `tap'
2014-03-23T21:08:04.938108+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.3/lib/rails/commands.rb:71:in `<top (required)>'
2014-03-23T21:08:04.935072+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.3/lib/active_support/lazy_load_hooks.rb:36:in `call'
2014-03-23T21:08:04.935072+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.3/lib/rails/initializable.rb:30:in `run'
2014-03-23T21:08:04.935788+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.3/lib/rails/application.rb:215:in `initialize!'
2014-03-23T21:08:04.936062+00:00 app[web.1]:    from /app/config.ru:in `new'
2014-03-23T21:08:04.937179+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.3/lib/rails/commands.rb:76:in `block in <top (required)>'
2014-03-23T21:08:06.548407+00:00 heroku[web.1]: Process exited with status 1
2014-03-23T21:08:06.574231+00:00 heroku[web.1]: State changed from starting to crashed
2014-03-23T21:08:07.873844+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=sixtasks.herokuapp.com request_id=7318cb7f-49d1-4d8a-bafd-e269821ce1bc fwd="173.35.60.133" dyno= connect= service= status=503 bytes=
2014-03-23T21:08:08.324562+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/favicon.ico host=sixtasks.herokuapp.com request_id=f03ca9a7-b3a8-4c7e-b7d5-cd3d7b7a280e fwd="173.35.60.133" dyno= connect= service= status=503 bytes=
2014-03-23T21:08:13.353853+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/favicon.ico host=sixtasks.herokuapp.com request_id=99ccb00a-d386-402d-8266-4b0e4dc39bc1 fwd="173.35.60.133" dyno= connect= service= status=503 bytes=
2014-03-23T21:08:11.632076+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=sixtasks.herokuapp.com request_id=0e9f41d3-f213-4a26-9008-d8a5fad2d78a fwd="173.35.60.133" dyno= connect= service= status=503 bytes=
2014-03-23T21:08:11.885694+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/favicon.ico host=sixtasks.herokuapp.com request_id=283244bb-5cde-4c39-8835-6b17cb031725 fwd="173.35.60.133" dyno= connect= service= status=503 bytes=
2014-03-23T21:08:13.179142+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=sixtasks.herokuapp.com request_id=3ea65bb3-7620-497c-a006-d70eacddf0d8 fwd="173.35.60.133" dyno= connect= service= status=503 bytes=
2014-03-23T21:13:46+00:00 heroku[slug-compiler]: Slug compilation started
2014-03-23T21:14:19+00:00 heroku[slug-compiler]: Slug compilation finished
2014-03-23T21:14:19.669604+00:00 heroku[web.1]: State changed from crashed to starting
2014-03-23T21:14:19.480299+00:00 heroku[api]: Deploy e4f2c99 by andrew@gmail.com
2014-03-23T21:14:19.480401+00:00 heroku[api]: Release v8 created by andrew.louis93@gmail.com
2014-03-23T21:14:24.461087+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 22691 -e production`

I think this part is the relevant part. 我认为这是相关的部分。

2014-03-23T21:08:04.934429+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.secret_key was not set. Please add the following to your Devise initializer: (RuntimeError)
2014-03-23T21:08:04.934429+00:00 app[web.1]:   config.secret_key = '0964de5caa044bc2ff80ae8c6a0f635d8088b348014048dd7a822e5156b4abb76e6a67d2ad2b3a77ec34221815146e3ce8c09822ec3058af44f6c85ae53073e0'
2014-03-23T21:08:04.934429+00:00 app[web.1]: Please ensure you restarted your application after installing Devise or setting the key.

Seems like you have set secret key in your local host but not on your heroku client. 似乎您已在本地主机中设置了密钥,但未在heroku客户端上设置了密钥。 Can you post your devise configuration file? 您可以发布您的设计配置文件吗? If you are setting your secret key with 如果您使用

ENV['secret_key']

or something you need to do 或您需要做的事情

heroku config:set secret_key=YOUR SECRET KEY HERE

For your heroku application to access it. 供您的heroku应用程序访问。 Comment if you have any question! 有任何问题请发表评论!

[Edit1] Add the following line yo your config/initializers/devise.rb [Edit1]在您的config / initializers / devise.rb中添加以下行

config.secret_key = '0964de5caa044bc2ff80ae8c6a0f635d8088b348014048dd7a822e5156b4abb76e6a67d2ad2b3a77ec34221815146e3ce8c09822ec3058af44f6c85ae53073e0' config.secret_key ='0964de5caa044bc2ff80ae8c6a0f635d8088b348014048dd7a822e5156b4abb76e6a67d2ad2b3a77ec34221815146e3ce8c09822ec3058af44f6c85ae53073e0'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM