应用程序使用Devise gem在Heroku上给出应用程序错误

 握住每一缕光 发布于 2023-01-20 13:43

我正在使用设计宝石,我在让我的应用程序在heroku上工作时遇到了问题.我不确定这是数据库的问题还是设计自己.在安装设备之前它工作正常.我在下面放了一个heroku日志.

2014-03-03T05:01:41.875781+00:00 app[web.1]: => Ctrl-C to shutdown server
2014-03-03T05:01:41.859124+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-03T05:01:41.875781+00:00 app[web.1]: => Booting WEBrick
2014-03-03T05:01:41.875781+00:00 app[web.1]: => Rails 4.0.2 application starting in production on http://0.0.0.0:24518
2014-03-03T05:01:41.859124+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-03T05:01:41.875781+00:00 app[web.1]: => Run `rails server -h` for more startup options
2014-03-03T05:01:41.875781+00:00 app[web.1]: Exiting
2014-03-03T05:01:41.859124+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-03T05:01:41.859124+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-03T05:01:41.859299+00:00 app[web.1]:    from bin/rails:4:in `require'
2014-03-03T05:01:43.043928+00:00 heroku[web.1]: Process exited with status 1
2014-03-03T05:01:43.048168+00:00 heroku[web.1]: State changed from starting to crashed
2014-03-03T05:01:47.110760+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=cafe-storefront.herokuapp.com request_id=46aaade3-34e3-4bde-ac2c-1558b8d41f87 fwd="165.123.212.150" dyno= connect= service= status=503 bytes=
2014-03-03T05:01:29.012828+00:00 heroku[api]: Release v21 created by indaso5@gmail.com
2014-03-03T05:01:29.012749+00:00 heroku[api]: Deploy 1684e77 by indaso5@gmail.com
2014-03-03T05:04:20+00:00 heroku[slug-compiler]: Slug compilation started
2014-03-03T05:04:52.700907+00:00 heroku[api]: Release v22 created by indaso5@gmail.com
2014-03-03T05:04:52.700835+00:00 heroku[api]: Deploy a200e5a by indaso5@gmail.com
2014-03-03T05:04:52+00:00 heroku[slug-compiler]: Slug compilation finished
2014-03-03T05:04:54.574587+00:00 heroku[web.1]: State changed from crashed to starting
2014-03-03T05:04:58.886761+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 52626 -e $RAILS_ENV`
2014-03-03T05:05:07.509088+00:00 app[web.1]:   config.secret_key = 'fa1127ef6554963392c3a187f65e4b47231e56282a5e057e18133cf6f097deb04a4fca8f6337bf647282cff36ddb9c03bd15e6acdcc9a3f192d0a47193730b38'
2014-03-03T05:05:07.509088+00:00 app[web.1]: 
2014-03-03T05:05:07.509088+00:00 app[web.1]: Please ensure you restarted your application after installing Devise or setting the key.
2014-03-03T05:05:07.509088+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-03T05:05:07.509088+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-03T05:05:07.509427+00:00 app[web.1]:    from /app/config/routes.rb:1:in `'
2014-03-03T05:05:07.509088+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-03T05:05:07.509088+00:00 app[web.1]:    from /app/config/routes.rb:2:in `block in '
2014-03-03T05:05:07.509427+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-03T05:05:07.509088+00:00 app[web.1]: 
2014-03-03T05:05:07.509088+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 `instance_exec'
2014-03-03T05:05:07.509088+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_block'
2014-03-03T05:05:07.509427+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-03T05:05:07.509427+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-03T05:05:07.509427+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_dependency'
2014-03-03T05:05:07.509427+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_paths'
2014-03-03T05:05:07.509427+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-03T05:05:07.509427+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-03T05:05:07.509697+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 '
2014-03-03T05:05:07.509427+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-03T05:05:07.509427+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-03T05:05:07.509697+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 '
2014-03-03T05:05:07.509697+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-03T05:05:07.509697+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-03T05:05:07.509697+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_initializers'
2014-03-03T05:05:07.509697+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-03T05:05:07.510365+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-03T05:05:07.510365+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-03T05:05:07.510365+00:00 app[web.1]:    from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:180:in `each'
2014-03-03T05:05:07.510365+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-03T05:05:07.510365+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-03T05:05:07.509697+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_load_hooks'
2014-03-03T05:05:07.509697+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-03T05:05:07.510662+00:00 app[web.1]:    from /app/config/environment.rb:5:in `'
2014-03-03T05:05:07.510662+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-03T05:05:07.510662+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_dependency'
2014-03-03T05:05:07.510365+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-03T05:05:07.510365+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-03T05:05:07.509697+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 in run_load_hooks'
2014-03-03T05:05:07.509697+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-03T05:05:07.511164+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-03T05:05:07.510662+00:00 app[web.1]:    from /app/config.ru:in `new'
2014-03-03T05:05:07.510365+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-03T05:05:07.510662+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-03T05:05:07.510662+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-03T05:05:07.510662+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-03T05:05:07.511164+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-03T05:05:07.511164+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-03T05:05:07.511164+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-03T05:05:07.510365+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-03T05:05:07.510365+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-03T05:05:07.511421+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.2/lib/rails/commands.rb:71:in `'
2014-03-03T05:05:07.511421+00:00 app[web.1]:    from bin/rails:4:in `require'
2014-03-03T05:05:07.511164+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 '
2014-03-03T05:05:07.511164+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-03T05:05:07.511421+00:00 app[web.1]:    from bin/rails:4:in `
' 2014-03-03T05:05:07.511164+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-03T05:05:07.511164+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-03T05:05:07.510662+00:00 app[web.1]: from /app/config.ru:3:in `block in
' 2014-03-03T05:05:07.510662+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-03T05:05:07.528568+00:00 app[web.1]: => Ctrl-C to shutdown server 2014-03-03T05:05:07.528568+00:00 app[web.1]: Exiting 2014-03-03T05:05:07.511164+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-03T05:05:07.528568+00:00 app[web.1]: => Run `rails server -h` for more startup options 2014-03-03T05:05:07.510662+00:00 app[web.1]: from /app/config.ru:in `
' 2014-03-03T05:05:07.511164+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-03T05:05:07.528568+00:00 app[web.1]: => Booting WEBrick 2014-03-03T05:05:07.528568+00:00 app[web.1]: => Rails 4.0.2 application starting in production on http://0.0.0.0:52626 2014-03-03T05:05:09.113693+00:00 heroku[web.1]: State changed from starting to crashed 2014-03-03T05:05:09.101758+00:00 heroku[web.1]: Process exited with status 1 2014-03-03T05:05:40.637755+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=cafe-storefront.herokuapp.com request_id=8382c70d-7bba-4e67-85b1-857710bc1692 fwd="165.123.212.150" dyno= connect= service= status=503 bytes= 2014-03-03T05:07:08.212039+00:00 heroku[api]: Starting process with command `bundle exec rake db:migrate` by indaso5@gmail.com 2014-03-03T05:07:12.824078+00:00 heroku[run.5785]: State changed from starting to up 2014-03-03T05:07:12.943178+00:00 heroku[run.5785]: Awaiting client 2014-03-03T05:07:12.998727+00:00 heroku[run.5785]: Starting process with command `bundle exec rake db:migrate` 2014-03-03T05:07:19.644271+00:00 heroku[run.5785]: Process exited with status 0 2014-03-03T05:07:19.784663+00:00 heroku[run.5785]: State changed from up to complete 2014-03-03T05:07:32.423670+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=cafe-storefront.herokuapp.com request_id=731934f1-d816-4ed0-af50-16d291ca105e fwd="**********" dyno= connect= service= status=503 bytes= 2014-03-03T05:07:33.983837+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=cafe-storefront.herokuapp.com request_id=f40fb60e-f9e3-45fb-b538-2094aa66a84a fwd="**********" dyno= connect= service= status=503 bytes= 2014-03-03T05:07:37.073653+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=cafe-storefront.herokuapp.com request_id=9c9924bc-e078-4e5c-8605-244b602f1194 fwd="*********" dyno= connect= service= status=503 bytes=

jvperrin.. 7

如本回答所述,您需要做的就是在初始化程序目录(config/initializers/devise.rb)中创建一个文件,然后将一个密钥放入您选择的密钥中:

config.secret_key = 'some1234keyq23'

确保你不只是复制这个密钥,请提出你自己的,如果使用公共项目,不要包含它,因为它应该是一个秘密.

撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有