ruby-on-rails – 部署到Heroku时的不同页面外观

ruby-on-rails – 部署到Heroku时的不同页面外观,第1张

概述我尝试使用一些 Kendo UI小部件,它们在开发中运行良好.但是当我将我的应用程序部署到Heroku时,它的外观发生了巨大变化. 我用TreeView小部件编写了一个示例页面.这就是它在开发中的呈现方式: 在Heroku的制作中: 可以看出,缺少列表标记(树标记?). 我怀疑这个问题与资产管道有关,因为做rake资产:预编译也会破坏开发中的东西(以及rake资产:清理还原它).但这让我感到困惑, 我尝试使用一些 Kendo UI小部件,它们在开发中运行良好.但是当我将我的应用程序部署到Heroku时,它的外观发生了巨大变化.

我用TreeVIEw小部件编写了一个示例页面.这就是它在开发中的呈现方式:

在Heroku的制作中:

可以看出,缺少列表标记(树标记?).

我怀疑这个问题与资产管道有关,因为做rake资产:预编译也会破坏开发中的东西(以及rake资产:清理还原它).但这让我感到困惑,因为我的Bootstrap标题在开发和生产中都运行良好(尽管在Heroku日志中有一些ActionController :: RoutingError(没有路由匹配[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'  endendgroup :test do  gem 'capybara'endgroup :development do  gem "nifty-generators"  gem "annotate"endgroup :production do  gem 'pg'endgroup :assets do  gem 'sass-rails','~> 3.2.3'  gem 'coffee-rails','~> 3.2.1'  gem 'uglifIEr','>= 1.0.3'endgem 'jquery-rails','~> 2.1.3'gem 'bcrypt-ruby',require: 'bcrypt'

development.rb:

config.cache_classes = falseconfig.whiny_nils = trueconfig.consIDer_all_requests_local       = trueconfig.action_controller.perform_caching = falseconfig.action_mailer.raise_delivery_errors = falseconfig.active_support.deprecation = :logconfig.action_dispatch.best_standards_support = :builtinconfig.active_record.mass_assignment_sanitizer = :strictconfig.active_record.auto_explain_threshold_in_seconds = 0.5config.assets.compress = falseconfig.assets.deBUG = true

production.rb:

config.cache_classes = trueconfig.consIDer_all_requests_local       = falseconfig.action_controller.perform_caching = trueconfig.serve_static_assets = falseconfig.assets.compress = trueconfig.assets.compile = falseconfig.assets.digest = trueconfig.i18n.fallbacks = trueconfig.active_support.deprecation = :notify

有谁知道如何解决这个问题?任何帮助表示赞赏.

更新1.

谢谢大家的意见,以下是其他信息.

Heroku日志:

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 +00002013-02-23T02:37:50+00:00 app[web.1]: Processing by EnvironmentTestController#index as HTML2013-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=12532013-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=1866742013-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=6488032013-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=02013-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 +00002013-02-23T02:37:55+00:00 app[web.1]: Processing by EnvironmentTestController#index as JsON2013-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=87772013-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 +00002013-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=7282013-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=3902013-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 +00002013-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=7282013-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 +00002013-02-23T02:38:19+00:00 app[web.1]: Processing by EnvironmentTestController#index as JsON2013-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相关的CSS文件:kendo.common.min.CSS(包含公共代码,unminified version)和kendo.bootstrap.min.CSS(主题特定代码,unminified version) .

顺便说一句,kendoui-rails gem中的供应商目录具有以下结构:

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’))的代码,这些代码未在生产中显示(但它们存在于bootstrap目录),所以我认为Chris Rueber是正确的.那我怎么解决这个问题呢?

解决方法 将bootstrap文件夹移动到vendor / assets / images(如果它不存在,则创建它).查看 http://guides.rubyonrails.org/asset_pipeline.html#css-and-sass获取更多信息. 总结

以上是内存溢出为你收集整理的ruby-on-rails – 部署到Heroku时的不同页面外观全部内容,希望文章能够帮你解决ruby-on-rails – 部署到Heroku时的不同页面外观所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/1294385.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-10
下一篇 2022-06-10

发表评论

登录后才能评论

评论列表(0条)

保存