简体   繁体   English

Rails 3.2.18应用程序资产无法在Heroku上正确显示

[英]Rails 3.2.18 application assets not displaying properly on Heroku

Ive been given a rails 3.2 app and heroku "server" to work on and deploy to. 我已经获得了Rails 3.2应用程序和heroku“服务器”来进行工作和部署。

I have deployed the application to heroku, and it is being served, but the website is all mumbled up and not displaying css/js properly. 我已经将该应用程序部署到了heroku,并且正在提供服务,但是网站全都杂乱无章,无法正确显示css / js。 From experience it seems that the assets have not been precompiled. 从经验来看,资产似乎尚未预编译。

Below is what I have tried so far to get this to work. 以下是到目前为止我为使此功能起作用而尝试过的方法。

  1. I ran RAILS_ENV=production rake assets:precompile on my local, committed the changes, and pushed to heroku. 我在本地运行RAILS_ENV=production rake assets:precompile ,提交更改,然后推送到heroku。 Page was still not rendering properly. 页面仍无法正确呈现。

  2. I ran rake assets:clean to remove public/assets. 我跑了rake assets:clean以删除公共/资产。 Then deployed to heroku, and watched them be precompiled on the deploy. 然后部署到heroku,并看着它们在部署中进行预编译。 This still resulted in the site not displaying properly. 这仍然导致网站无法正常显示。

  3. Started playing with my production.rb file 开始播放我的production.rb文件

    config.cache_classes = true

    config.consider_all_requests_local = false

    config.action_controller.perform_caching = true

    config.serve_static_assets = false

    config.assets.compress = true

    config.assets.compile = false

    config.assets.digest = true

    config.assets.precompile += %w( ie-html5shiv-printshiv.js ie-selectivizr.min.js )

this still has resulted in my site not displaying correctly. 这仍然导致我的网站无法正确显示。

Im at odds end, not sure what else to try. 我很奇怪,不确定是否还有其他尝试。 Any other tips or pointers? 还有其他提示或指示吗?

Add the rails_12factor gem to your gemfile, bundle, commit and push. 将rails_12factor gem添加到您的gemfile中,进行捆绑,提交和推送。

Gemfile.rb Gemfile.rb

'gem 'rails_12factor', group: :production'

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

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