无效的CSS应用程序Michael Hartl教程 [英] invalid css on rails app Michael Hartl tutorial

查看:90
本文介绍了无效的CSS应用程序Michael Hartl教程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚完成了Mike Hartle rails教程的第五章,当我将文件加载到heroku和css时出现了一些困惑,无论出于何种原因,这些文件都不像我本地的那样运行。

  2013-09-17T00:40:31.225391 + 00: 00 app [web.1]:vendor / bundle / ruby​​ / 2.0.0 / gems / activesupport-4.0.0 / lib / active_support / tagged_logging.rb:25:在`tagged'
2013-09-17T00: 40:31.225544 + 00:00 app [web.1]:vendor / bundle / ruby​​ / 2.0.0 / gems / actionpack-4.0.0 / lib / action_dispatch / middleware / static.rb:64:`call'
2013-09-17T00:40:31.225544 + 00:00 app [web.1]:vendor / bundle / ruby​​ / 2.0.0 / gems / rack-1.5.2 / lib / rack / content_length.rb:14: ``call'
2013-09-17T00:40:31.225544 + 00:00 app [web.1]:vendor / bundle / ruby​​ / 2.0.0 / gems / rack-1.5.2 / lib / rack /处理程序/ webrick.rb:60:在`service'
2013-09-17T00:40:31.359182 + 00:00 heroku [router]:at = info method = GET path = / favicon.ico host = fathomless-earth-8911.herokuapp.com fwd =66.235。 48.7dyno = web.1 connect = 1ms service = 4ms status = 304 bytes = 0
2013-09-17T00:40:31.225689 + 00:00 app [web.1]:
2013-09 -17T00:40:31.225689 + 00:00 app [web.1]:
2013-09-17T00:40:31.225689 + 00:00 app [web.1]:ActionController :: RoutingError(No route matches [ GET]/images/rails.png):
2013-09-17T00:40:31.225689 + 00:00 app [web.1]:
2013-09-17T00:40:31.225689 + 00:00 app [web.1]:vendor / bundle / ruby​​ / 2.0.0 / gems / railties-4.0.0 / lib / rails / rack / logger.rb:38:在`call_app'
2013-09-17T00:40:31.226038 + 00:00 app [web.1]:vendor / bundle / ruby​​ / 2.0.0 / gems / railties-4.0.0 / lib / rails / rack / logger.rb:21:在`block in call'中
2013-09- 17T00:40:31.225689 + 00:00 app [web.1]:vendor / bundle / ruby​​ / 2.0.0 / gems / actionpack-4.0.0 / lib / action_dispatch / middleware / show_exceptions.rb:30:
2013-09-17T00:40:31.226038 + 00:00 app [web.1]:vendor / bundle / ruby​​ / 2.0.0 / gems / activesupport-4.0.0 / lib / active_support / tagged_logging.rb: 67:在`block in tagged'
2013-09-17T00:40:31.225689 + 00:00 app [web.1]:vendor / bundle / ruby​​ / 2.0.0 / gems / actionpack-4.0.0 / lib / action_dispatch / middleware / debug_exceptions.rb:21:在`call'
2013-09-17T00:40:31.226038 + 00:00 app [web.1]:vendor / bundle / ruby​​ / 2.0.0 / gems / rack-1.5.2 / lib / rack / methodoverride.rb:21:在`call'
2013-09-17T00:40:31.226038 + 00:00 app [web.1]:vendor / bundle / ruby / 2.0.0 / gems / actionpack-4.0.0 / lib / action_dispatch / middleware / request_id.rb:21:在`call'
2013-09-17T00:40:31.226038 + 00:00 app [web.1]:vendor / bundle / ruby​​ / 2.0.0 / gems / activesupport-4.0.0 / lib / active_support / cache / strategy / local_cache.rb:83:在`call'
2013-09-17T00:40:31.226038 + 00:00 app [web.1]:vendor / bundle / ruby​​ / 2.0.0 / gems / railties-4.0。 0 / lib / rails / rack / logger.rb:21:在`call'
2013-09-17T00:40:31.226038 + 00:00 app [web.1]:vendor / bundle / ruby​​ / 2.0。 0 / gems / activesupport-4.0.0 / lib / active_support / tagged_logging.rb:67:在`tagged'
2013-09-17T00:40:31.226038 + 00:00 app [web.1]:vendor / bundle / ruby​​ / 2.0.0 / gems / activesupport-4.0.0 / lib / active_support / tagged_logging.rb:25:在`tagged'
2013-09-17T00:40:31.226188 + 00:00 app [web.1]:vendor / bundle / ruby​​ / 2.0.0 / gems / rack-1.5.2 / lib / rack / lock.rb: 17:在`call'
2013-09-17T00:40:31.226188 + 00:00 app [web.1]:vendor / bundle / ruby​​ / 2.0.0 / gems / rack-1.5.2 / lib / rack / content_length.rb:14:在`call'中
2013-09-17T00:40:31.226188 + 00:00 app [web.1]:
2013-09-17T00:40:31.226188+ 00:00 app [web.1]:vendor / bundle / ruby​​ / 2.0.0 / gems / railties-4.0.0 / lib / rails / engine.rb:511:在`call'
20 13-09-17T00:40:31.226188 + 00:00 app [web.1]:vendor / ruby​​-2.0.0 / lib / ruby​​ / 2.0.0 / webrick / httpserver.rb:94:'run'
2013-09-17T00:40:31.226188 + 00:00 app [web.1]:
2013-09-17T00:40:31.226188 + 00:00 app [web.1]:vendor / bundle / ruby / 2.0.0 / gems / railties-4.0.0 / lib / rails / application.rb:97:在`call'
2013-09-17T00:40:31.226038 + 00:00 app [web.1 ]:vendor / bundle / ruby​​ / 2.0.0 / gems / actionpack-4.0.0 / lib / action_dispatch / middleware / static.rb:64:in`call'
2013-09-17T00:40 :31.226038 + 00:00 app [web.1]:vendor / bundle / ruby​​ / 2.0.0 / gems / rack-1.5.2 / lib / rack / runtime.rb:17:in`call'
2013 -09-17T00:40:31.226188 + 00:00 app [web.1]:vendor / ruby​​-2.0.0 / lib / ruby​​ / 2.0.0 / webrick / httpserver.rb:138:在'service'
2013-09-17T00:40:31.226188 + 00:00 app [web.1]:vendor / ruby​​-2.0.0 / lib / ruby​​ / 2.0.0 / webrick / server.rb:295:in`block in start_thread '
2013-09-17T00:40:31.226188 + 00:00 app [web.1]:vendor / bundle / ruby​​ / 2.0.0 / gems / rack-1.5.2 / lib / rack / handler / webrick .rb:60:in'service'


解决方案

到相同的问题(使用Windows 7)。我发现这个问题只是上面Heijmans的部分回答。 Hartl并没有针对这个错误发生的原因,也没有详细说明,但是在第2.3.5节和第3章的介绍结束时解决了这个问题。

经过以下过程。
首先,我跑了

 > heroku run bundle exec rake资源:预编译
> heroku打开

但我仍然有错误。然后,我按照以下方式在书中跟随Hartl的建议。

 > git add。 
> git commit -m为Heroku添加预编译资源
> git push
> git push heroku master
> heroku运行rake db:migrate
>有趣的是,哈特尔说:这不应该是必要的,我一直都不能

  [标签:heroku] $ b重现这个问题,但这些报告很常见,所以我把它包含在这里作为参考。 $ b [tag:railstutorial.org] 
[tag:Windows 7]
[tag:Rails 4]


I just finished chapter five of the Mike Hartle rails tutorial and was a little confused when I loaded my files to heroku and the css for whatever reason was not working its magic like it was for me localy. Here is a copy of my heroku logs if that helps at all.

2013-09-17T00:40:31.225391+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/tagged_logging.rb:25:in `tagged'                                                                                           
2013-09-17T00:40:31.225544+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/static.rb:64:in `call'                                                                                            
2013-09-17T00:40:31.225544+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/content_length.rb:14:in `call'                                                                                                                
2013-09-17T00:40:31.225544+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/handler/webrick.rb:60:in `service'                                                                                                            
2013-09-17T00:40:31.359182+00:00 heroku[router]: at=info method=GET path=/favicon.ico host=fathomless-earth-8911.herokuapp.com fwd="66.235.48.7" dyno=web.1 connect=1ms service=4ms status=304 bytes=0                                         
2013-09-17T00:40:31.225689+00:00 app[web.1]:                                                                                                                                                                                                   
2013-09-17T00:40:31.225689+00:00 app[web.1]:                                                                                                                                                                                                   
2013-09-17T00:40:31.225689+00:00 app[web.1]: ActionController::RoutingError (No route matches [GET] "/images/rails.png"):                                                                                                                      
2013-09-17T00:40:31.225689+00:00 app[web.1]:                                                                                                                                                                                                   
2013-09-17T00:40:31.225689+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/rack/logger.rb:38:in `call_app'                                                                                                          
2013-09-17T00:40:31.226038+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/rack/logger.rb:21:in `block in call'                                                                                                     
2013-09-17T00:40:31.225689+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'                                                                                   
2013-09-17T00:40:31.226038+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/tagged_logging.rb:67:in `block in tagged'                                                                                  
2013-09-17T00:40:31.225689+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'                                                                                  
2013-09-17T00:40:31.226038+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/methodoverride.rb:21:in `call'                                                                                                                
2013-09-17T00:40:31.226038+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/request_id.rb:21:in `call'                                                                                        
2013-09-17T00:40:31.226038+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/cache/strategy/local_cache.rb:83:in `call'                                                                                 
2013-09-17T00:40:31.226038+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/rack/logger.rb:21:in `call'                                                                                                              
2013-09-17T00:40:31.226038+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/tagged_logging.rb:67:in `tagged'                                                                                           
2013-09-17T00:40:31.226038+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/tagged_logging.rb:25:in `tagged'                                                                                           
2013-09-17T00:40:31.226188+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/lock.rb:17:in `call'                                                                                                                          
2013-09-17T00:40:31.226188+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/content_length.rb:14:in `call'                                                                                                                
2013-09-17T00:40:31.226188+00:00 app[web.1]:                                                                                                                                                                                                   
2013-09-17T00:40:31.226188+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/engine.rb:511:in `call'                                                                                                                  
2013-09-17T00:40:31.226188+00:00 app[web.1]:   vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'                                                                                                                              
2013-09-17T00:40:31.226188+00:00 app[web.1]:                                                                                                                                                                                                   
2013-09-17T00:40:31.226188+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/application.rb:97:in `call'                                                                                                              
2013-09-17T00:40:31.226038+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/static.rb:64:in `call'                                                                                            
2013-09-17T00:40:31.226038+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/runtime.rb:17:in `call'                                                                                                                       
2013-09-17T00:40:31.226188+00:00 app[web.1]:   vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'                                                                                                                         
2013-09-17T00:40:31.226188+00:00 app[web.1]:   vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'                                                                                                               
2013-09-17T00:40:31.226188+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/handler/webrick.rb:60:in `service'  

解决方案

I ran into the same issue (using Windows 7). I found that the question was only partially answered by Heijmans above. Hartl isn't very specific about why or how this error occurs but does address the issue in section 2.3.5 and the end of the intro to Chapter 3.

Mine worked after the following process. First, I ran

> heroku run bundle exec rake assets:precompile
> heroku open

But I still got errors. Then I followed Hartl's suggestion in the book in the following manner.

> git add .
> git commit -m "Add precompiled assets for Heroku"
> git push
> git push heroku master  
> heroku run rake db:migrate
> heroku open

Interestingly, Hartl states that "This shouldn’t be necessary, and I have been unable to reproduce the issue, but the reports are common enough that I include it here for reference."

[tag: heroku]
[tag: railstutorial.org]
[tag: Windows 7]
[tag: Rails 4]

这篇关于无效的CSS应用程序Michael Hartl教程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆