Rails 4: assets not loading in production

前端 未结 18 1438
梦如初夏
梦如初夏 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:13

    For Rails 5, you should enable the follow config code:

    config.public_file_server.enabled = true

    By default, Rails 5 ships with this line of config:

    config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?

    Hence, you will need to set the environment variable RAILS_SERVE_STATIC_FILES to true.

提交回复
热议问题