Heroku资产文件始终为空
首先,我做了很多谷歌搜索,甚至让事情在Heroku上工作,但似乎无论我是否让heroku在slug编译期间预编译我的资产,或者我自己预编译并提交它们,无论哪种方式,我的Rails 4应用程序的application.css总是空的:
$curl -i http://www.boxscoregeeks.com/assets/application-c712146df692b0fca6c21c0bf1dddcd5.css HTTP/1.1 200 OK Content-Type: text/css Date: Sun,01 Sep 2013 00:50:10 GMT Last-Modified: Sun,01 Sep 2013 00:46:54 GMT Status: 200 OK X-Sendfile: /app/public/assets/application-c712146df692b0fca6c21c0bf1dddcd5.css Content-Length: 0 Connection: keep-alive 为了验证,它在本地很好: $curl -I http://localhost:3001/assets/application-c712146df692b0fca6c21c0bf1dddcd5.css HTTP/1.1 200 OK Last-Modified: Sat,31 Aug 2013 03:46:55 GMT Content-Type: text/css Content-Length: 106237 Connection: keep-alive Server: thin 1.5.1 codename Straight Razor 我的清单: >我的production.rb文件中有config.serve_static_assets = true. 几乎我所有的谷歌搜索都告诉我上面做了这些事情,但在这里我仍然有一个空的applicaiton.css文件.任何帮助都会很棒. 谢谢! 解决方法
我找到了自己对这个问题的答案.
有问题的应用程序是我从rails 3升级的应用程序.所以我构建并部署了一个空的新rails 4应用程序(这个工作).通过区分production.rb文件,我注意到非工作应用程序中有这样的行: # Specifies the header that your server uses for sending files # (comment out if your front-end server doesn't support this) config.action_dispatch.x_sendfile_header = "X-Sendfile" # Use 'X-Accel-Redirect' for nginx 此配置行在新的rails 4应用程序中被注释掉.而Heroku文档推荐这个: config.action_dispatch.x_sendfile_header = nil # For Heroku 当我改变这一点时,一切都按预期工作.当应用程序在rails 3中的Cedar上运行时,这似乎并不重要. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |