0
當我配置我的應用程序文件,我把我的插件文件夾下的資產,並在我的config/application.rb中的文件添加以下行:Rails的資產插件文件夾不被部署閱讀
require_relative 'boot'
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module Cnd
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 5.1
config.assets.paths << Rails.root.join("app", "assets", "fonts")
config.assets.paths << Rails.root.join("app", "assets", "images")
config.assets.paths << Rails.root.join("app", "assets", "bootstrap")
config.assets.paths << Rails.root.join("app", "assets", "rs-plugin-5")
config.assets.paths << Rails.root.join("app", "assets", "magnific-popup")
config.assets.paths << Rails.root.join("app", "assets", "owlcarousel2")
config.assets.paths << Rails.root.join("app", "assets", "morphext")
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
end
end
一切都正常運行在我的本地當我部署到Amazon EC2的我收到以下錯誤:
我不明白爲什麼它在本地加載的文件,但是當我部署它不是。我現在只是在開發環境中部署。不知道這是否有所作爲,但我正在本地生產環境中工作,因此我預編譯了資產。我在開發中部署的原因是因爲我只需要快速向客戶展示進度。
你有預編譯生產資產嗎?在生產服務器中使用此命令RAILS_ENV =生產捆綁包exec rake資產:預編譯 – widjajayd
我做了預編譯 –