【问题标题】:Ruby on rails precompiled images not showingRuby on rails 预编译图像未显示
【发布时间】:2015-05-12 10:31:07
【问题描述】:

我在 site5 上部署了我的应用程序,我的 .css 和 .js 正在完美预编译 ,我在另一边的图像正在预编译(文件),但未显示在最终视图中。

这是我的生产环境:

  CmsDevise::Application.configure do
  # Settings specified here will take precedence over those in config/application.rb

  config.relative_url_root = "/~firmaltt"
  config.assets.precompile = ['*.js', '*.css', '*.css.erb', '*.*']

  # 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 = false

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

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

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

文件图像路由列在 /assets(文件)和我的 manifest.yml 中,但仍未显示。 rake assets:precompile env=production 运行没有问题。

我每次都使用 touch tmp/restart.txt 重新启动服务器。 删除所有资产并再次预编译。还是什么都没有:(

更新,评论:

#config.relative_url_root = "/~firmaltt"

【问题讨论】:

  • 添加了 config.assets.precompile += %w[ *.png *.jpeg *.jpg *.gif ] 仍然没有

标签: ruby-on-rails ruby rake production


【解决方案1】:

我认为 site5 没有存储您的图像。所以, 尝试以下步骤 -

第 1 步:转到 http://aws.amazon.com/s3/,创建新帐户。
第 2 步:将您的图像存储在那里并将它们标记为公开
第 3 步:它会为您生成一个公共图片 url。

将这些图片网址用于图片。

【讨论】:

    猜你喜欢
    • 2012-06-03
    • 2011-11-30
    • 2012-11-24
    • 2013-09-09
    • 2014-09-02
    • 1970-01-01
    • 2013-06-16
    • 1970-01-01
    • 2011-11-29
    相关资源
    最近更新 更多