我跟着guide from Heroku 通过添加环境变量并添加
config.action_controller.asset_host = "https://#{ENV['FOG_DIRECTORY']}.s3.amazonaws.com"
到environment / production.rb
我看到资产已上传到我的s3存储桶,我可以访问它们。
但在我的网站上,我没有看到任何使用asset_path标签的资产,如css
background-image: url("<%= asset_path "image.jpg" %>");
当我查看源代码时,我看到了这样一个文件的链接:
url("https://.s3.amazonaws.com/assets/image.jpg")
这很奇怪,因为css和js工作(使用FOG_DIRECTORY var)。那么为什么FOG_DIRECTORY env在这里被跳过,好像它不存在一样?
答案 0 :(得分:0)
通过
解决config.asset_host = "https://#{ENV['FOG_DIRECTORY']}.s3.amazonaws.com"
并使用
heroku labs:enable user-env-compile