Rails 4: assets not loading in production

前端 未结 18 1443
梦如初夏
梦如初夏 2020-11-29 15:15

I\'m trying to put my app into production and image and css asset paths aren\'t working.

Here\'s what I\'m currently doing:

  • Image assets live in /app/a
18条回答
  •  感情败类
    2020-11-29 16:12

    Found this:

    The configuration option config.serve_static_assets has been renamed to config.serve_static_files to clarify its role.

    in config/environments/production.rb:

    # Disable serving static files from the `/public` folder by default since
    # Apache or NGINX already handles this.
    config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
    

    So set env RAILS_SERVE_STATIC_FILES or using Nginx to serving static files. Add config.serve_static_assets = true will still work, but removed in future.

提交回复
热议问题