2013-02-22 4 views
5

일부 Kendo UI 위젯을 사용하려고합니다. 개발시 잘 작동합니다. 그러나 Heroku에 내 앱을 배포하면 모양이 크게 달라집니다.Heroku에 배포 할 때 페이지 모양이 달라집니다.

TreeView 위젯으로 샘플 페이지를 작성했습니다. 이 개발에 렌더링하는 방법이다 :

tree view in development

그리고 Heroku가에 생산

:

tree view in production

이 볼 수 있듯이

목록 마커 (? 나무 마커가) 누락되었습니다.

rake assets:precompile을 수행하면 문제가 발생하기 때문에 자산 파이프 라인과 관련이있는 것으로 의심됩니다 (rake assets:clean은 다시 되돌립니다). 그러나 그 이유는 내 Bootstrap 헤더가 개발 및 생산에서 잘 작동하기 때문입니다 (Heroku 로그에 일부 ActionController::RoutingError (No route matches [GET] "/assets/Bootstrap/loading.gif") 오류가 있음에도 불구하고).

Gemfile :

source 'https://rubygems.org' 

gem 'rails' 
gem "ancestry" 
gem "bootstrap-sass" 
gem "will_paginate" 
gem "bootstrap-will_paginate" 
gem "truncate_html" 
gem "slim-rails" 
gem "kendoui-rails" 

group :development, :test do 
    gem 'sqlite3' 
    gem 'rspec-rails' 
    gem "minitest" 

    platform :ruby do 
    gem 'therubyracer' 
    end 
end 

group :test do 
    gem 'capybara' 
end 

group :development do 
    gem "nifty-generators" 
    gem "annotate" 
end 

group :production do 
    gem 'pg' 
end 

group :assets do 
    gem 'sass-rails', '~> 3.2.3' 
    gem 'coffee-rails', '~> 3.2.1' 
    gem 'uglifier', '>= 1.0.3' 
end 

gem 'jquery-rails', '~> 2.1.3' 

gem 'bcrypt-ruby', require: 'bcrypt' 

development.rb :

config.cache_classes = false 
config.whiny_nils = true 
config.consider_all_requests_local  = true 
config.action_controller.perform_caching = false 
config.action_mailer.raise_delivery_errors = false 
config.active_support.deprecation = :log 
config.action_dispatch.best_standards_support = :builtin 
config.active_record.mass_assignment_sanitizer = :strict 
config.active_record.auto_explain_threshold_in_seconds = 0.5 
config.assets.compress = false 
config.assets.debug = true 

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.i18n.fallbacks = true 
config.active_support.deprecation = :notify 

합니까 아무도 그걸 고치는 법을 알아? 어떤 도움을 주셔서 감사합니다.


업데이트 1.

의견을 보내 주셔서 감사합니다. 여기에 추가 정보가 있습니다.

Heroku가 로그 : 내 매니페스트 CSS 파일에서

2013-02-23T02:37:50+00:00 app[web.1]: Started GET "/environment_test/index" for 193.169.36.82 at 2013-02-23 02:37:50 +0000 
2013-02-23T02:37:50+00:00 app[web.1]: Processing by EnvironmentTestController#index as HTML 
2013-02-23T02:37:50+00:00 app[web.1]: Rendered environment_test/index.html.slim within layouts/application (23.3ms) 
2013-02-23T02:37:50+00:00 app[web.1]: Rendered layouts/_header.slim (57.2ms) 
2013-02-23T02:37:50+00:00 app[web.1]: Completed 200 OK in 159ms (Views: 158.7ms | ActiveRecord: 0.0ms) 
2013-02-23T02:37:50+00:00 heroku[router]: at=info method=GET path=/environment_test/index host=biotriz.herokuapp.com fwd="193.169.36.82" dyno=web.1 queue=0 wait=2ms connect=20ms service=394ms status=200 bytes=1253 
2013-02-23T02:37:50+00:00 heroku[router]: at=info method=GET path=/assets/application-43a283ce09b9af356379df3e89b8b1cc.css host=biotriz.herokuapp.com fwd="193.169.36.82" dyno=web.1 queue=0 wait=0ms connect=1ms service=10ms status=200 bytes=186674 
2013-02-23T02:37:51+00:00 heroku[router]: at=info method=GET path=/assets/application-8ac08b06d5d57f91da7af9d1e1c345c0.js host=biotriz.herokuapp.com fwd="193.169.36.82" dyno=web.1 queue=0 wait=7ms connect=20ms service=64ms status=200 bytes=648803 
2013-02-23T02:37:55+00:00 heroku[router]: at=info method=GET path=/favicon.ico host=biotriz.herokuapp.com fwd="193.169.36.82" dyno=web.1 queue=0 wait=0ms connect=0ms service=5ms status=200 bytes=0 
2013-02-23T02:37:55+00:00 app[web.1]: Started GET "/environment_test/index.json" for 193.169.36.82 at 2013-02-23 02:37:55 +0000 
2013-02-23T02:37:55+00:00 app[web.1]: Processing by EnvironmentTestController#index as JSON 
2013-02-23T02:37:55+00:00 heroku[router]: at=info method=GET path=/assets/glyphicons-halflings-white-6cccd17a7aed91dbc0157d343c68c0d9.png host=biotriz.herokuapp.com fwd="193.169.36.82" dyno=web.1 queue=0 wait=0ms connect=3ms service=66ms status=200 bytes=8777 
2013-02-23T02:37:55+00:00 app[web.1]: Completed 200 OK in 104ms (Views: 0.6ms | ActiveRecord: 31.9ms) 
2013-02-23T02:37:55+00:00 app[web.1]: Started GET "/assets/Bootstrap/loading.gif" for 193.169.36.82 at 2013-02-23 02:37:55 +0000 
2013-02-23T02:37:55+00:00 app[web.1]: 
2013-02-23T02:37:55+00:00 app[web.1]: ActionController::RoutingError (No route matches [GET] "/assets/Bootstrap/loading.gif"): 
2013-02-23T02:37:55+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call' 
2013-02-23T02:37:55+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/action_dispatch/middleware/show_exceptions.rb:56:in `call' 
2013-02-23T02:37:55+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/railties-3.2.12/lib/rails/rack/logger.rb:32:in `call_app' 
2013-02-23T02:37:55+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/railties-3.2.12/lib/rails/rack/logger.rb:16:in `block in call' 
2013-02-23T02:37:55+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.12/lib/active_support/tagged_logging.rb:22:in `tagged' 
2013-02-23T02:37:55+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/railties-3.2.12/lib/rails/rack/logger.rb:16:in `call' 
2013-02-23T02:37:55+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/action_dispatch/middleware/request_id.rb:22:in `call' 
2013-02-23T02:37:55+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/methodoverride.rb:21:in `call' 
2013-02-23T02:37:55+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/runtime.rb:17:in `call' 
2013-02-23T02:37:55+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.12/lib/active_support/cache/strategy/local_cache.rb:72:in `call' 
2013-02-23T02:37:55+00:00 heroku[router]: at=info method=GET path=/assets/Bootstrap/loading.gif host=biotriz.herokuapp.com fwd="193.169.36.82" dyno=web.1 queue=0 wait=1ms connect=12ms service=56ms status=404 bytes=728 
2013-02-23T02:37:55+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/lock.rb:15:in `call' 
2013-02-23T02:37:55+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/action_dispatch/middleware/static.rb:62:in `call' 
2013-02-23T02:37:55+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:136:in `forward' 
2013-02-23T02:37:55+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:245:in `fetch' 
2013-02-23T02:37:55+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:185:in `lookup' 
2013-02-23T02:37:55+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:66:in `call!' 
2013-02-23T02:37:55+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:51:in `call' 
2013-02-23T02:37:55+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/railties-3.2.12/lib/rails/engine.rb:479:in `call' 
2013-02-23T02:37:55+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/railties-3.2.12/lib/rails/application.rb:223:in `call' 
2013-02-23T02:37:55+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/content_length.rb:14:in `call' 
2013-02-23T02:37:55+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/railties-3.2.12/lib/rails/rack/log_tailer.rb:17:in `call' 
2013-02-23T02:37:55+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/handler/webrick.rb:59:in `service' 
2013-02-23T02:37:55+00:00 app[web.1]: /usr/local/lib/ruby/1.9.1/webrick/httpserver.rb:111:in `service' 
2013-02-23T02:37:55+00:00 app[web.1]: /usr/local/lib/ruby/1.9.1/webrick/httpserver.rb:70:in `run' 
2013-02-23T02:37:55+00:00 app[web.1]: /usr/local/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread' 
2013-02-23T02:37:55+00:00 app[web.1]: 
2013-02-23T02:37:55+00:00 app[web.1]: 
2013-02-23T02:37:55+00:00 heroku[router]: at=info method=GET path=/environment_test/index.json host=biotriz.herokuapp.com fwd="193.169.36.82" dyno=web.1 queue=0 wait=6ms connect=16ms service=121ms status=200 bytes=390 
2013-02-23T02:37:55+00:00 app[web.1]: Started GET "/assets/Bootstrap/sprite.png" for 193.169.36.82 at 2013-02-23 02:37:55 +0000 
2013-02-23T02:37:55+00:00 app[web.1]: 
2013-02-23T02:37:55+00:00 app[web.1]: ActionController::RoutingError (No route matches [GET] "/assets/Bootstrap/sprite.png"): 
2013-02-23T02:37:55+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call' 
2013-02-23T02:37:55+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/action_dispatch/middleware/show_exceptions.rb:56:in `call' 
2013-02-23T02:37:55+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/railties-3.2.12/lib/rails/rack/logger.rb:32:in `call_app' 
2013-02-23T02:37:55+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/railties-3.2.12/lib/rails/rack/logger.rb:16:in `block in call' 
2013-02-23T02:37:55+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.12/lib/active_support/tagged_logging.rb:22:in `tagged' 
2013-02-23T02:37:55+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/railties-3.2.12/lib/rails/rack/logger.rb:16:in `call' 
2013-02-23T02:37:55+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/action_dispatch/middleware/request_id.rb:22:in `call' 
2013-02-23T02:37:55+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/methodoverride.rb:21:in `call' 
2013-02-23T02:37:55+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/runtime.rb:17:in `call' 
2013-02-23T02:37:55+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.12/lib/active_support/cache/strategy/local_cache.rb:72:in `call' 
2013-02-23T02:37:55+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/lock.rb:15:in `call' 
2013-02-23T02:37:55+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/action_dispatch/middleware/static.rb:62:in `call' 
2013-02-23T02:37:55+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:136:in `forward' 
2013-02-23T02:37:55+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:245:in `fetch' 
2013-02-23T02:37:55+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:185:in `lookup' 
2013-02-23T02:37:55+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:66:in `call!' 
2013-02-23T02:37:55+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:51:in `call' 
2013-02-23T02:37:55+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/railties-3.2.12/lib/rails/engine.rb:479:in `call' 
2013-02-23T02:37:55+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/railties-3.2.12/lib/rails/application.rb:223:in `call' 
2013-02-23T02:37:55+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/content_length.rb:14:in `call' 
2013-02-23T02:37:55+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/railties-3.2.12/lib/rails/rack/log_tailer.rb:17:in `call' 
2013-02-23T02:37:55+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/handler/webrick.rb:59:in `service' 
2013-02-23T02:37:55+00:00 app[web.1]: /usr/local/lib/ruby/1.9.1/webrick/httpserver.rb:111:in `service' 
2013-02-23T02:37:55+00:00 app[web.1]: /usr/local/lib/ruby/1.9.1/webrick/httpserver.rb:70:in `run' 
2013-02-23T02:37:55+00:00 app[web.1]: /usr/local/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread' 
2013-02-23T02:37:55+00:00 app[web.1]: 
2013-02-23T02:37:55+00:00 app[web.1]: 
2013-02-23T02:37:55+00:00 heroku[router]: at=info method=GET path=/assets/Bootstrap/sprite.png host=biotriz.herokuapp.com fwd="193.169.36.82" dyno=web.1 queue=0 wait=0ms connect=1ms service=7ms status=404 bytes=728 
2013-02-23T02:38:19+00:00 app[web.1]: Started GET "/environment_test/index.json?id=33" for 193.169.36.82 at 2013-02-23 02:38:19 +0000 
2013-02-23T02:38:19+00:00 app[web.1]: Processing by EnvironmentTestController#index as JSON 
2013-02-23T02:38:19+00:00 app[web.1]: Parameters: {"id"=>"33"} 
2013-02-23T02:38:19+00:00 app[web.1]: Completed 200 OK in 17ms (Views: 0.4ms | ActiveRecord: 14.0ms) 
2013-02-23T02:38:19+00:00 heroku[router]: at=info method=GET path=/environment_test/index.json?id=33 host=biotriz.herokuapp.com fwd="193.169.36.82" dyno=web.1 queue=0 wait=0ms connect=1ms service=26ms status=200 bytes=266 

두 검도 관련 CSS-파일이 포함되어 있습니다 (이 application.css) : kendo.common.min.css (공통 코드를 포함하는, unminified version) 및 kendo.bootstrap.min.css (테마별 코드, unminified version).

vendor 
└── assets 
    ├── javascripts 
    │   └── ... 
    └── stylesheets 
     └── kendo 
      ├── Bootstrap 
      │ ├── editor.png 
      │   ├── imagebrowser.png 
      │   ├── loading.gif 
      │   ├── loading-image.gif 
      │   ├── slider-h.gif 
      │   ├── slider-v.gif 
      │   └── sprite.png 
      ├── ... # Some other theme-specific dirs 
      ├── kendo.bootstrap.min.css 
      ├── kendo.common.min.css 
      └── ... # Some other theme-specific CSS's 

kendo.bootstrap.min.css는 이미지 (url('Bootstrap/sprite.png')url('Bootstrap/loading.gif'))를 참조 코드가 포함 된 파일 : 그런데

kendoui-rails 보석의 vendor 디렉토리는 다음과 같은 구조를 가지고 프로덕션에서는 표시되지 않지만 (Bootstrap 디렉토리에 있음) Chris Rueber가 정확하다고 생각합니다. 어떻게 해결할 수 있습니까?

+1

사전 컴파일 오류 문제를 해결할 수 있도록 heroku 로그를 게시하십시오. – Jesper

+3

자산 파이프 라인 문제에 대한 귀하의 평가에 동의합니다. 이미지 (화살표/표시기)는 CSS에서 어떻게 참조됩니까? 언뜻보기에는 ../images/arrow-left.jpg 종류의 참조가 CSS에서 언급 한 것 같지만 자산 파이프 라인 내부에있을 때는 제대로 작동하지 않습니다. –

+0

@Jesper, 로그를 추가했습니다. – nameless

답변

4

Bootstrap 폴더를 vendor/assets/images 폴더로 이동하거나 존재하지 않는 경우 만들어야합니다. 자세한 내용은 http://guides.rubyonrails.org/asset_pipeline.html#css-and-sass을 확인하십시오.

+0

답변 해 주셔서 감사합니다. 내일 다시 시도하겠습니다. – nameless

+0

@ QumaraSixOneTour, 그것은 나를 위해 일했습니다. – nameless

1

실제로 문제는 the issuesKendoUI-Rails github 저장소에 설명되어 있습니다. 그것은 css 파일을 병합하기 때문에 자산을 미리 컴파일 한 후에 나타나는 것으로 보입니다. 이렇게하면 .png 파일의 올바른 경로가 손실됩니다. 당신은 (당신의 development.rb에) 같이, 오프 디버그를 설정하여 생산에 버그를 재현 할 수 있습니다

config.assets.debug = false 

한 가지 가능한 해결 방법은 .css 파일은 다음과 같은 자산 파이프 라인에서 분리 포함하는 것입니다 :

<link rel="stylesheet" href="../assets/kendo/kendo.bootstrap.min.css"> 
하지만, @fadzlan는 설명 티켓의 저자로, 그것은 application server 대신 web server에 의해 제공 css 자산으로 이어질 것입니다.

+0

감사합니다. 실제로 문제 추적기를 직접 확인 했어야합니다. – nameless

관련 문제