css - Heroku 找不到带有 stylesheet_tag 命令的 css(在本地工作)

标签 css ruby-on-rails ruby heroku

这是 application.html.erb 文件中的一行 <%= stylesheet_link_tag yield(:css), 媒体: "all", "data-turbolinks-track"=> true %> 并且 css 加载每个不同页面所需的文件名。

本地服务器的结果非常好,在 Heroku 中,该命令提供的 css 抛出“您要查找的页面不存在。

您可能输错了地址,或者页面可能已移动。”

以防万一我尝试预编译 Assets 。感谢您提前回复,我将继续显示日志:

C:\Sites\rankthisup>heroku run rake assets:precompile
Running `rake assets:precompile` attached to terminal... up, run.4248

C:\Sites\rankthisup>heroku logs
2013-07-28T03:15:15.339168+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rac
k-1.5.2/lib/rack/methodoverride.rb:21:in `call'
2013-07-28T03:15:15.339168+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/act
ionpack-4.0.0/lib/action_dispatch/middleware/static.rb:64:in `call'
2013-07-28T03:15:15.339168+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rac
k-1.5.2/lib/rack/lock.rb:17:in `call'
2013-07-28T03:15:15.339168+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rai
lties-4.0.0/lib/rails/engine.rb:511:in `call'
2013-07-28T03:15:15.339460+00:00 app[web.1]:   vendor/ruby-1.9.3/lib/ruby/1.9.1/
webrick/server.rb:191:in `block in start_thread'
2013-07-28T03:15:15.339851+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rai
lties-4.0.0/lib/rails/rack/logger.rb:21:in `block in call'
2013-07-28T03:15:15.339460+00:00 app[web.1]:   vendor/ruby-1.9.3/lib/ruby/1.9.1/
webrick/httpserver.rb:94:in `run'
2013-07-28T03:15:15.339460+00:00 app[web.1]:   vendor/ruby-1.9.3/lib/ruby/1.9.1/
webrick/httpserver.rb:138:in `service'
2013-07-28T03:15:15.339168+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rac
k-1.5.2/lib/rack/handler/webrick.rb:60:in `service'
2013-07-28T03:15:15.339168+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rai
lties-4.0.0/lib/rails/application.rb:97:in `call'
2013-07-28T03:15:15.339460+00:00 app[web.1]: ActionController::RoutingError (No
route matches [GET] "/stylesheets/allrankings.css"):
2013-07-28T03:15:15.339460+00:00 app[web.1]:
2013-07-28T03:15:15.339460+00:00 app[web.1]:
2013-07-28T03:15:15.339460+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rai
lties-4.0.0/lib/rails/rack/logger.rb:38:in `call_app'
2013-07-28T03:15:15.339460+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/act
ionpack-4.0.0/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
2013-07-28T03:15:15.339168+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rac
k-1.5.2/lib/rack/content_length.rb:14:in `call'
2013-07-28T03:15:15.339460+00:00 app[web.1]:
2013-07-28T03:15:15.339460+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/act
ionpack-4.0.0/lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
2013-07-28T03:15:15.339851+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/act
ivesupport-4.0.0/lib/active_support/tagged_logging.rb:25:in `tagged'
2013-07-28T03:15:15.339851+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/act
ivesupport-4.0.0/lib/active_support/tagged_logging.rb:67:in `tagged'
2013-07-28T03:15:15.339851+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/act
ivesupport-4.0.0/lib/active_support/tagged_logging.rb:67:in `block in tagged'
2013-07-28T03:15:15.339851+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/act
ivesupport-4.0.0/lib/active_support/cache/strategy/local_cache.rb:83:in `call'
2013-07-28T03:15:15.339851+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/act
ionpack-4.0.0/lib/action_dispatch/middleware/request_id.rb:21:in `call'
2013-07-28T03:15:15.339851+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rai
lties-4.0.0/lib/rails/rack/logger.rb:21:in `call'
2013-07-28T03:15:15.340004+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rai
lties-4.0.0/lib/rails/engine.rb:511:in `call'
2013-07-28T03:15:15.340004+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rai
lties-4.0.0/lib/rails/application.rb:97:in `call'
2013-07-28T03:15:15.339851+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/act
ionpack-4.0.0/lib/action_dispatch/middleware/static.rb:64:in `call'
2013-07-28T03:15:15.339851+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rac
k-1.5.2/lib/rack/methodoverride.rb:21:in `call'
2013-07-28T03:15:15.339851+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rac
k-1.5.2/lib/rack/runtime.rb:17:in `call'
2013-07-28T03:15:15.340004+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rac
k-1.5.2/lib/rack/lock.rb:17:in `call'
2013-07-28T03:15:15.340004+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rac
k-1.5.2/lib/rack/content_length.rb:14:in `call'
2013-07-28T03:15:15.340004+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rac
k-1.5.2/lib/rack/handler/webrick.rb:60:in `service'
2013-07-28T03:15:15.340004+00:00 app[web.1]:   vendor/ruby-1.9.3/lib/ruby/1.9.1/
webrick/httpserver.rb:138:in `service'
2013-07-28T03:15:15.340004+00:00 app[web.1]:   vendor/ruby-1.9.3/lib/ruby/1.9.1/
webrick/httpserver.rb:94:in `run'
2013-07-28T03:15:15.340004+00:00 app[web.1]:   vendor/ruby-1.9.3/lib/ruby/1.9.1/
webrick/server.rb:191:in `block in start_thread'
2013-07-28T03:15:15.340004+00:00 app[web.1]:
2013-07-28T03:15:15.340004+00:00 app[web.1]:
2013-07-28T03:15:15.709491+00:00 heroku[router]: at=info method=GET path=/favico
n.ico host=rankthisup.herokuapp.com fwd="200.81.44.68" dyno=web.1 connect=2ms se
rvice=8ms status=304 bytes=0
2013-07-28T03:21:46.287023+00:00 heroku[router]: at=info method=GET path=/favico
n.ico host=rankthisup.herokuapp.com fwd="200.81.44.68" dyno=web.1 connect=3ms se
rvice=7ms status=304 bytes=0
2013-07-28T03:21:49.857863+00:00 heroku[router]: at=info method=GET path=/styles
heets/categories.css host=rankthisup.herokuapp.com fwd="200.81.44.68" dyno=web.1
 connect=1ms service=9ms status=404 bytes=1351
2013-07-28T03:21:49.851502+00:00 app[web.1]: Started GET "/stylesheets/categorie
s.css" for 200.81.44.68 at 2013-07-28 03:21:49 +0000
2013-07-28T03:21:49.851575+00:00 app[web.1]: Started GET "/stylesheets/categorie
s.css" for 200.81.44.68 at 2013-07-28 03:21:49 +0000
2013-07-28T03:21:49.852815+00:00 app[web.1]:
2013-07-28T03:21:49.852815+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/act
ionpack-4.0.0/lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
2013-07-28T03:21:49.852815+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/act
ionpack-4.0.0/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
2013-07-28T03:21:49.852815+00:00 app[web.1]: ActionController::RoutingError (No
route matches [GET] "/stylesheets/categories.css"):
2013-07-28T03:21:49.852815+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rai
lties-4.0.0/lib/rails/rack/logger.rb:21:in `block in call'
2013-07-28T03:21:49.852815+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/act
ivesupport-4.0.0/lib/active_support/tagged_logging.rb:67:in `tagged'
2013-07-28T03:21:49.852815+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rai
lties-4.0.0/lib/rails/rack/logger.rb:21:in `call'
2013-07-28T03:21:49.852999+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/act
ionpack-4.0.0/lib/action_dispatch/middleware/request_id.rb:21:in `call'
2013-07-28T03:21:49.852815+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/act
ivesupport-4.0.0/lib/active_support/tagged_logging.rb:25:in `tagged'
2013-07-28T03:21:49.852999+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rac
k-1.5.2/lib/rack/lock.rb:17:in `call'
2013-07-28T03:21:49.852999+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rac
k-1.5.2/lib/rack/content_length.rb:14:in `call'
2013-07-28T03:21:49.852815+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rai
lties-4.0.0/lib/rails/rack/logger.rb:38:in `call_app'
2013-07-28T03:21:49.852999+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rac
k-1.5.2/lib/rack/methodoverride.rb:21:in `call'
2013-07-28T03:21:49.852999+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rac
k-1.5.2/lib/rack/runtime.rb:17:in `call'
2013-07-28T03:21:49.852999+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/act
ivesupport-4.0.0/lib/active_support/cache/strategy/local_cache.rb:83:in `call'
2013-07-28T03:21:49.852999+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/act
ionpack-4.0.0/lib/action_dispatch/middleware/static.rb:64:in `call'
2013-07-28T03:21:49.852999+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rai
lties-4.0.0/lib/rails/engine.rb:511:in `call'
2013-07-28T03:21:49.853158+00:00 app[web.1]:   vendor/ruby-1.9.3/lib/ruby/1.9.1/
webrick/httpserver.rb:138:in `service'
2013-07-28T03:21:49.852815+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/act
ivesupport-4.0.0/lib/active_support/tagged_logging.rb:67:in `block in tagged'
2013-07-28T03:21:49.853158+00:00 app[web.1]:
2013-07-28T03:21:49.853158+00:00 app[web.1]: ActionController::RoutingError (No
route matches [
GET] "/stylesheets/categories.css"):
2013-07-28T03:21:49.853158+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/act
ionpack-4.0.0/lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
2013-07-28T03:21:49.853158+00:00 app[web.1]:   vendor/ruby-1.9.3/lib/ruby/1.9.1/
webrick/httpserver.rb:94:in `run'
2013-07-28T03:21:49.853158+00:00 app[web.1]:   vendor/ruby-1.9.3/lib/ruby/1.9.1/
webrick/server.rb:191:in `block in start_thread'
2013-07-28T03:21:49.852999+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rai
lties-4.0.0/lib/rails/application.rb:97:in `call'
2013-07-28T03:21:49.852999+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rac
k-1.5.2/lib/rack/handler/webrick.rb:60:in `service'
2013-07-28T03:21:49.853687+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rai
lties-4.0.0/lib/rails/rack/logger.rb:21:in `block in call'
2013-07-28T03:21:49.853687+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/act
ivesupport-4.0.0/lib/active_support/tagged_logging.rb:67:in `block in tagged'
2013-07-28T03:21:49.853687+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/act
ivesupport-4.0.0/lib/active_support/tagged_logging.rb:25:in `tagged'
2013-07-28T03:21:49.853687+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rai
lties-4.0.0/lib/rails/rack/logger.rb:21:in `call'
2013-07-28T03:21:49.853158+00:00 app[web.1]:
2013-07-28T03:21:49.853930+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rai
lties-4.0.0/lib/rails/engine.rb:511:in `call'
2013-07-28T03:21:49.853930+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rai
lties-4.0.0/lib/rails/application.rb:97:in `call'
2013-07-28T03:21:49.853930+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rac
k-1.5.2/lib/rack/lock.rb:17:in `call'
2013-07-28T03:21:49.853930+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rac
k-1.5.2/lib/rack/content_length.rb:14:in `call'
2013-07-28T03:21:49.853930+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rac
k-1.5.2/lib/rack/handler/webrick.rb:60:in `service'
2013-07-28T03:21:49.853158+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/act
ionpack-4.0.0/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
2013-07-28T03:21:49.853158+00:00 app[web.1]:
2013-07-28T03:21:49.853687+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/act
ivesupport-4.0.0/lib/active_support/tagged_logging.rb:67:in `tagged'
2013-07-28T03:21:49.853687+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rac
k-1.5.2/lib/rack/methodoverride.rb:21:in `call'
2013-07-28T03:21:49.853930+00:00 app[web.1]:   vendor/ruby-1.9.3/lib/ruby/1.9.1/
webrick/httpserver.rb:138:in `service'
2013-07-28T03:21:49.853930+00:00 app[web.1]:   vendor/ruby-1.9.3/lib/ruby/1.9.1/
webrick/httpserver.rb:94:in `run'
2013-07-28T03:21:49.853930+00:00 app[web.1]:   vendor/ruby-1.9.3/lib/ruby/1.9.1/
webrick/server.rb:191:in `block in start_thread'
2013-07-28T03:21:49.853930+00:00 app[web.1]:
2013-07-28T03:21:49.853687+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rac
k-1.5.2/lib/rack/runtime.rb:17:in `call'
2013-07-28T03:21:49.853158+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rai
lties-4.0.0/lib/rails/rack/logger.rb:38:in `call_app'
2013-07-28T03:21:49.853687+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/act
ionpack-4.0.0/lib/action_dispatch/middleware/static.rb:64:in `call'
2013-07-28T03:21:49.853930+00:00 app[web.1]:
2013-07-28T03:21:49.853687+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/act
ionpack-4.0.0/lib/action_dispatch/middleware/request_id.rb:21:in `call'
2013-07-28T03:21:49.853687+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/act
ivesupport-4.0.0/lib/active_support/cache/strategy/local_cache.rb:83:in `call'
2013-07-28T03:21:50.724700+00:00 heroku[router]: at=info method=GET path=/favico
n.ico host=rankthisup.herokuapp.com fwd="200.81.44.68" dyno=web.1 connect=3ms se
rvice=7ms status=304 bytes=0
2013-07-28T03:22:34.593098+00:00 heroku[run.1552]: State changed from up to comp
lete
2013-07-28T03:22:34.571741+00:00 heroku[run.1552]: Process exited with status 0
2013-07-28T03:22:57.340524+00:00 heroku[api]: Starting process with command `bun
dle exec rake assets:precompile` by myxoh10@gmail.com
2013-07-28T03:23:01.652538+00:00 heroku[run.4248]: Awaiting client
2013-07-28T03:23:01.698517+00:00 heroku[run.4248]: Starting process with command
 `bundle exec rake assets:precompile`
2013-07-28T03:23:02.879867+00:00 heroku[run.4248]: State changed from starting t
o up
2013-07-28T03:23:10.507117+00:00 heroku[run.4248]: Process exited with status 0
2013-07-28T03:23:10.524617+00:00 heroku[run.4248]: State changed from up to comp
lete

最佳答案

可能是 categories.css 不在编译列表中。你可以在 config/application.rb 中尝试这样的事情:

config.assets.precompile += ['categories.css']

替换任何实际文件名(可能是 categories.sass)。

关于css - Heroku 找不到带有 stylesheet_tag 命令的 css(在本地工作),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17904702/

相关文章:

css - 如何设置背景图片?

ruby-on-rails - 我可以从模型中获取表、列和类型信息吗?

javascript - 如何从 View 中删除逻辑

ruby-on-rails - rails 和其他 gem 在安装时会在任何地方安装文档吗?

css - Google +1 按钮的动态 CSS 填充

html - 缩小页面时扭曲的菜单栏

php - 如何使用 xpath 从内部 css 获取背景图像?

ruby-on-rails - Rails : Segmentation fault at Rjb when in background process, 不在后台时工作正常吗?

ruby-on-rails - 在 ROR 中为 JSON 处理函数添加 XML 支持

ruby-on-rails - 保存后回形针重命名文件