我在运行rake db时遇到此错误:在heroku上迁移db:seed for my rails publify blog
rake aborted!
ArgumentError: Missing required arguments: aws_access_key_id, aws_secret_access_key
/app/vendor/bundle/ruby/2.0.0/gems/fog-core-1.27.3/lib/fog/core/service.rb:244:in `validate_options'
/app/vendor/bundle/ruby/2.0.0/gems/fog-core-1.27.3/lib/fog/core/service.rb:268:in `handle_settings'
/app/vendor/bundle/ruby/2.0.0/gems/fog-core-1.27.3/lib/fog/core/service.rb:98:in `new'
/app/vendor/bundle/ruby/2.0.0/gems/fog-core-1.27.3/lib/fog/storage.rb:25:in `new'
/app/vendor/bundle/ruby/2.0.0/gems/carrierwave-0.10.0/lib/carrierwave/uploader/configuration.rb:83:in `eager_load_fog'
/app/vendor/bundle/ruby/2.0.0/gems/carrierwave-0.10.0/lib/carrierwave/uploader/configuration.rb:96:in `fog_credentials='
/app/config/initializers/carrierwave.rb:2:in `block in <top (required)>'
/app/vendor/bundle/ruby/2.0.0/gems/carrierwave-0.10.0/lib/carrierwave/uploader/configuration.rb:118:in `configure'
/app/vendor/bundle/ruby/2.0.0/gems/carrierwave-0.10.0/lib/carrierwave.rb:14:in `configure'
/app/config/initializers/carrierwave.rb:1:in `<top (required)>'
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.1.9/lib/active_support/dependencies.rb:241:in `load'
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.1.9/lib/active_support/dependencies.rb:241:in `block in load'
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.1.9/lib/active_support/dependencies.rb:232:in `load_dependency'
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.1.9/lib/active_support/dependencies.rb:241:in `load'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.9/lib/rails/engine.rb:648:in `block in load_config_initializer'
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.1.9/lib/active_support/notifications.rb:161:in `instrument'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.9/lib/rails/engine.rb:647:in `load_config_initializer'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.9/lib/rails/engine.rb:612:in `block (2 levels) in <class:Engine>'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.9/lib/rails/engine.rb:611:in `each'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.9/lib/rails/engine.rb:611:in `block in <class:Engine>'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.9/lib/rails/initializable.rb:30:in `instance_exec'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.9/lib/rails/initializable.rb:30:in `run'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.9/lib/rails/initializable.rb:55:in `block in run_initializers'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.9/lib/rails/initializable.rb:44:in `each'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.9/lib/rails/initializable.rb:44:in `tsort_each_child'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.9/lib/rails/initializable.rb:54:in `run_initializers'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.9/lib/rails/application.rb:300:in `initialize!'
/app/config/environment.rb:5:in `<top (required)>'
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.1.9/lib/active_support/dependencies.rb:247:in `require'
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.1.9/lib/active_support/dependencies.rb:247:in `block in require'
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.1.9/lib/active_support/dependencies.rb:232:in `load_dependency'
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.1.9/lib/active_support/dependencies.rb:247:in `require'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.9/lib/rails/application.rb:276:in `require_environment!'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.9/lib/rails/application.rb:405:in `block in run_tasks_blocks'
我已经根据publify的github页面上的说明在AWS终端中设置了这些参数 - https://github.com/publify/publify
我缺少什么?
答案 0 :(得分:1)
运行以下命令以添加AWS凭据:heroku config:set AWS_ACCESS_KEY_ID=PasteTheKeyInHereNoQuotes
和heroku config:set AWS_SECRET_ACCESS_KEY=PasteTheSecretKeyHereAlsoNoQuotes
。然后,要确认这些已设置,请运行heroku config
,您应该看到两者都已列出。最后,在终端中运行heroku run console
并输入ENV['AWS_ACCESS_KEY_ID']
,您应该会看到您在上一步中添加的密钥的值。然后,重新运行迁移。