2012-09-13 32 views
0

請,請你看看我的配置?我正在嘗試在我的應用中設置carrierwave,但它在生產服務器中不起作用。它在本地工作,甚至作爲生產環境。問題在於它將圖像保存到tmp目錄中,但結果爲'空文件上傳結果'。我嘗試保存到文件並保存到S3,結果相同。我正在使用Passenger - Nginx。載波設置

我現在已經爲此生氣了兩天了。任何想法或提示甚至關於我如何調試這是值得歡迎的。我設置了所有權限,所以我不認爲這是一個權限問題。它可能是一個緩存的東西,這些文件存儲在tmp目錄中,但似乎該應用程序沒有看到它們爲用戶所擁有?

謝謝!

#application.rb 

require File.expand_path('../boot', __FILE__) 

require 'rails/all' 

if defined?(Bundler) 
    Bundler.require(*Rails.groups(:assets => %w(development test))) 
end 

module MyApp 
    class Application < Rails::Application 
    config.encoding = "utf-8" 
    config.filter_parameters += [:password] 
    config.active_support.escape_html_entities_in_json = true 
    config.active_record.whitelist_attributes = true 
    config.assets.initialize_on_precompile = false 
    config.assets.enabled = true 
    config.assets.version = '1.0' 
    end 
end 



# avatar_uploader.rb 

class AvatarUploader < CarrierWave::Uploader::Base 
    include CarrierWave::MiniMagick 
    include ActiveModel::Conversion 
    extend ActiveModel::Naming 
    def extension_white_list 
    %w(jpg jpeg gif png mp3) 
end 
    include Sprockets::Helpers::RailsHelper 
    include Sprockets::Helpers::IsolatedHelper 

    storage :fog 

    def store_dir 
    "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" 
    end 

    version :thumb do 
    process :resize_to_fill => [200,200] 
    end 

end 



# carrierwave.rb 

CarrierWave.configure do |config| 
    config.fog_credentials = { 
     :provider    => 'AWS',  # required 
     :aws_access_key_id  => 'ACCESS',  # required 
     :aws_secret_access_key => 'SECRET',  # required 
     :region     => 'eu-west-1' # optional, defaults to 'us-east-1' 
    } 
    config.fog_directory = 'my_app_bucket' 
    end 



# production.rb 

MyApp::Application.configure do 

    config.cache_classes = true 
    config.consider_all_requests_local  = true # default false, debug true 
    config.action_controller.perform_caching = true #default true 
    config.serve_static_assets = true # Carrierwave true - Default false 
    config.assets.compress = true 
    config.assets.compile = false # false for real production 
    config.assets.digest = true 
    config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx 
    config.log_level = :debug 
    config.cache_store = :dalli_store 
    config.assets.precompile += %w(search.js) 
    config.i18n.fallbacks = true 
    config.active_support.deprecation = :notify 
    config.action_mailer.default_url_options = { :host => 'localhost' } 
end 

回答

0

解決!

我的ImageMagick安裝缺少代表。現在:

convert -list configure 

    DELEGATES  bzlib fontconfig freetype jpeg jng lqr pango png x11 xml zlib