1

当我使用 nginx 和乘客运行我的应用程序时,甚至没有单个 css 或 js 加载..它向我显示以下错误。

cache: [GET /assets/application-403103e41ab40b92f00b841ac9afb23a.js] miss 

    Started GET "/assets/application-403103e41ab40b92f00b841ac9afb23a.js" for localhost at 2013-10-07 10:48:13 +0530    
    ActionController::RoutingError (No route matches [GET] "/assets/application-403103e41ab40b92f00b841ac9afb23a.js"):

    cache: [GET /assets/jquery.blockUI-49c048033e3dfb8cfab8eff7edbdc553.js] miss    

    Started GET "/assets/jquery.blockUI-49c048033e3dfb8cfab8eff7edbdc553.js" for localhost at 2013-10-07 10:48:18 +0530    
    ActionController::RoutingError (No route matches [GET] "/assets/jquery.blockUI-49c048033e3dfb8cfab8eff7edbdc553.js"):

在我的 config/environments/production.rb

# Code is not reloaded between requests
  config.cache_classes = true

  # Full error reports are disabled and caching is turned on
  config.consider_all_requests_local       = false
  config.action_controller.perform_caching = true

  # Disable Rails's static asset server (Apache or nginx will already do this)
  config.serve_static_assets = true

  # Compress JavaScripts and CSS
  config.assets.compress = true

  # Don't fallback to assets pipeline if a precompiled asset is missed
  config.assets.compile = false

  # Generate digests for assets URLs
  config.assets.digest = true

在 config/application.rb

config.assets.precompile << Proc.new do |path|
    if path =~ /\.(css|js)\z/
        full_path = Rails.application.assets.resolve(path).to_path
        app_assets_path = Rails.root.join('app', 'assets').to_path
        if full_path.starts_with? app_assets_path
          puts "including asset: " + full_path
          true
        else
          puts "excluding asset: " + full_path
          false
        end
    else
        false
    end
    end

我已经单独编译了每个文件,因为它是我的应用程序的要求,我的application.cssapplication.js文件不包含任何清单。This files are blank.

请帮忙...

4

0 回答 0