【问题标题】:What is the right way to put app on production - assets not working将应用程序投入生产的正确方法是什么 - 资产不起作用
【发布时间】:2013-08-22 18:32:44
【问题描述】:

就像主题一样 - 将应用程序置于生产模式的正确方法是什么。现在我在资产中的任何 img 都没有加载。我没有任何 img、字体和资产——同样对于 fancybox-rails gem 也没有资产。我尝试了所有方法,只有使用 config.assets.compile = true 才能正常工作。

config.cache_classes = true


  config.consider_all_requests_local       = false
  config.action_controller.perform_caching = true


  config.serve_static_assets = true


  config.assets.compress = true


  config.assets.compile = false


  config.assets.digest = true

这不起作用。

 config.assets.paths << "#{Rails.root}/app/assets/fonts"


... /assets/Lato-Bol.ttf 404 (Not Found)  \
.../assets/fancybox-40d79ef494fcf5ca4727cb13b9e69c33.png 404 (Not Found) 

【问题讨论】:

  • 你跑bundle exec rake assets:precompile了吗?

标签: ruby-on-rails


【解决方案1】:

试试这个:

RAILS_ENV=production bundle exec rake assets:precompile

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-08-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-12-19
    • 2019-05-25
    • 1970-01-01
    相关资源
    最近更新 更多