所有内容都在本地版本上使用,但在Heroku
当我在生产站点上查看源时,我可以看到指向CSS文件的链接
<link href="/dist/css/example.min.css" rel="stylesheet" type="text/css" />
但是当我单击它时,我会得到默认值
"您要寻找的页面不存在。您可能已经误解了地址或页面可能已经移动了。"
git状态"分支机构上没有提交工作目录清洁"
生产环境
Rails.application.configure do
config.cache_classes = true
config.serve_static_assets = true
config.eager_load = true
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
config.assets.js_compressor = :uglifier
config.assets.compile = true
config.force_ssl = true
config.log_level = :debug
config.log_tags = [ :request_id ]
config.action_mailer.perform_caching = false
config.i18n.fallbacks = true
config.active_support.deprecation = :notify
config.log_formatter = ::Logger::Formatter.new
if ENV["RAILS_LOG_TO_STDOUT"].present?
logger = ActiveSupport::Logger.new(STDOUT)
logger.formatter = config.log_formatter
config.logger = ActiveSupport::TaggedLogging.new(logger)
end
config.active_record.dump_schema_after_migration = false
end
不确定从哪里开始。这是唯一单击时呈现错误页面的CSS链接。所有其他CSS链接都起作用。我出错了什么想法?
更新:所以我决定放弃一段时间并休息一下。回来后,我决定刷新生产Env,它可以正常工作,而没有对我作为备份的"原始"文件副本进行任何更改,然后再更改问题以解决问题……所以我不知道发生了什么,也许在Heroku的终结上有问题?外星人?量子机械磁性反转?
您必须使用asset_path,将CSS文件移至应用程序/asssets/stylesheets,然后在application.scss.scss
中添加需求如果您不想使用de Asset_path,则应将CSS移至公共文件夹。
尝试预编译您的资产管道。
RAILS_ENV=production bundle exec rake assets:precompile
git add public/assets
git commit -m "vendor compiled assets"
push to github and then heroku