我有一个类似于this帖子中的问题,但那里的答案对我不起作用。
尝试更新我的Heroku应用并收到以下消息:
remote: Using rake 11.1.0
...
Bundle complete! 17 Gemfile dependencies, 55 gems now installed.
remote: Gems in the groups development and test were not installed.
remote: Bundled gems are installed into ./vendor/bundle.
remote: Bundle completed (0.40s)
remote: Cleaning up the bundler cache.
remote: -----> Preparing app for Rails asset pipeline
remote: Running: rake assets:precompile
remote: rake aborted!
remote: FlickRaw::FlickrAppNotConfigured: No API key or secret defined!
remote: /tmp/build_da0b10dd4509bfcc0a788669177fe992/vendor/bundle/ruby/2.2.0/gems/flickraw-0.9.8/lib/flickraw/api.rb:41:in `initialize'
remote: /tmp/build_da0b10dd4509bfcc0a788669177fe992/vendor/bundle/ruby/2.2.0/gems/flickraw-0.9.8/lib/flickraw.rb:20:in `new'
remote: /tmp/build_da0b10dd4509bfcc0a788669177fe992/vendor/bundle/ruby/2.2.0/gems/flickraw-0.9.8/lib/flickraw.rb:20:in `flickr'
...
我很确定这与No API key or secret defined!
行有关,但我在/config/initializers/01_keys.rb
中声明了Flickraw api密钥和密码。
如果需要,以下是该文件的内容。我使用figaro gem将环境变量存储在隐藏文件中:
require 'flickraw'
FlickRaw.api_key = ENV['API_KEY']
FlickRaw.shared_secret = ENV['SHARED_SECRET']
token = flickr.get_request_token
auth_url = flickr.get_authorize_url(token['oauth_token'], :perms => 'delete')
puts "Open this url in your process to complete the authication process : #{auth_url}"
puts "Copy here the number given when you complete the process."
verify = gets.strip
begin
flickr.get_access_token(token['oauth_token'], token['oauth_token_secret'], verify)
login = flickr.test.login
puts "You are now authenticated as #{login.username} with token #{flickr.access_token} and secret #{flickr.access_secret}"
rescue FlickRaw::FailedResponse => e
puts "Authentication failed : #{e.msg}"
end
答案 0 :(得分:1)
如果该行说明"没有定义API密钥或秘密!"我开始在那里看,因为flickraw肯定会因此而抛出错误。使用puts语句或其他东西确保这些ENV变量正常工作。