简体   繁体   English

图像src在heroku上有额外的编号,但是为什么在本地有效?

[英]Image src have extra number on heroku but it works locally why?

The Image are shown locally but its cant shown on heroku why? 图片显示在本地,但无法在heroku上显示?

When i open inspect element it have numbers after the src image like this 当我打开检查元素时,像这样的src图像后会有数字

<img alt="" src="/assets/slider-1-small-5becce2e5e78cb63c4cdb619548f388c.jpg">

The number that you see in the image name is the fingerprinting, that Rails adds to assets in production environment, to assure, that if you update some asset, it will not be loaded from a browser cache for a user, who already visited your website. 您在图像名称中看到的数字是Rails在生产环境中添加到资产的指纹,以确保如果您更新了某些资产,该资产不会从已经访问过您网站的用户的浏览器缓存中加载。

You can read more about it here: http://guides.rubyonrails.org/asset_pipeline.html#what-is-fingerprinting-and-why-should-i-care-questionmark 您可以在此处了解更多信息: http : //guides.rubyonrails.org/asset_pipeline.html#what-is-fingerprinting-and-why-should-i-care-questionmark

But i suppose, that the problem that you have, might be related with a config config.serve_static_assets = true in your config/production.rb file. 但是我想,您遇到的问题可能与config/production.rb文件中的config config.serve_static_assets = true有关。 Heroku has a nice article about the Rails 4 deployment and Assets Pipeline in general: Heroku总体上有一篇不错的文章,介绍了Rails 4的部署和Assets Pipeline:

https://devcenter.heroku.com/articles/rails-4-asset-pipeline https://devcenter.heroku.com/articles/rails-4-asset-pipeline

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM