我在我的rails应用程序中得到了下面的错误。
我运行Ruby on Rails应用程序,在预览中单击,得到如下所示:
Internal Server Error You must set config.secret key base in your app's
config
DEPRECATION WARNING: You didn't set config.secret_key_base. Read the upgrade documentation to learn more about this new config option. (called from service at /home/action/.rvm/rubies/ruby-2.0.0
-p247/lib/ruby/2.0.0/webrick/httpserver.rb:138)
[2014-02-18 21:48:14] ERROR RuntimeError: You must set config.secret_key_base in your app's config.
/home/action/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.2/lib/rails/application.rb:145:in `env_config'
/home/action/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.2/lib/rails/engine.rb:507:in `call'
/home/action/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.2/lib/rails/application.rb:97:in `call'
/home/action/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.5.2/lib/rack/lock.rb:17:in `call'
/home/action/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.5.2/lib/rack/content_length.rb:14:in `call'
/home/action/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.5.2/lib/rack/handler/webrick.rb:60:in `service'
/home/action/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'
/home/action/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
/home/action/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'有人能帮帮我吗。
谢谢
发布于 2014-02-19 05:56:04
我认为,您的config/initializers目录中应该有一个名为secret_token.rb的文件。在该文件中,您将看到类似以下内容:
# Be sure to restart your server when you modify this file.
# Your secret key is used for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks.
# You can use `rake secret` to generate a secure secret key.
# Make sure your secret_key_base is kept private
# if you're sharing your code publicly.
MyApp::Application.config.secret_key_base = 'de6156670dfadf0101011000112310980198236544e55623a143c9ae5254842b2c66fcc59849'如果不存在,请尝试创建一个。
https://stackoverflow.com/questions/21866186
复制相似问题