全栈学习39天 11-24 heroku

Objective

chrome 开发者模式
今天的任务是将项目上传到herohu
gem "fog"

'''
config/initializers/carrierwave.rb
CarrierWave.configure do |config|
if Rails.env.production?
config.storage :fog

config.fog_credentials = {
provider: 'AWS',

aws_access_key_id: ENV["AWS_ACCESS_KEY_ID"], # 你的 key

aws_secret_access_key: ENV["AWS_SECRET_ACCESS_KEY"], # 你的 secret key

region: 'eu-west-1' # 你的 S3 bucket 的 Region 位置

}
config.fog_directory = ENV["AWS_BUCKET_NAME"] # 你设定的 bucket name
else
config.storage :file
end
end
'''

gem "figaro"

bundle install
figaro install

cp config/application.yml config/application.yml.example
修改 .gitignore 加入config/application.yml 不会被同步到github


出错了,解决
https://github.com/fog/fog/issues/3429

gem "fog"

gem 'fog', require: 'fog/aws'

Since require works with $LOAD_PATH and my Rails app has lib in its load path, I did the following:

$ touch lib/fog.rb
where the file contains the following:

module Fog
# :D
end
and then in my CarrierWave initializer I did the following:

require 'carrierwave/storage/abstract'
require 'carrierwave/storage/file'
require 'carrierwave/storage/fog'

CarrierWave.configure do |config|

the app then works with fog-aws.

storage :file

storage :fog

figaro heroku:set -e production
就解决了

Reflective

把我们的项目上传到heroku了,遇到的问题都解决了

Comments

comments powered by Disqus