加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby-on-rails – Rails 500错误:application.css未预编译

发布时间:2020-12-17 04:00:12 所属栏目:百科 来源:网络整理
导读:我已经在Mediatemple的Ubuntu linux box(ve)服务器上使用Apache在Passenger上运行Rails.当我尝试加载任何页面时,我的应用程序给出了500错误(Rails错误,而不是Apache错误): http://www.mvngmtns.com 我在config / environments / production.rb中看到一篇关
我已经在Mediatemple的Ubuntu linux box(ve)服务器上使用Apache在Passenger上运行Rails.当我尝试加载任何页面时,我的应用程序给出了500错误(Rails错误,而不是Apache错误): http://www.mvngmtns.com

我在config / environments / production.rb中看到一篇关于更改此行的文章:

config.assets.compile = true

但这并没有解决我的问题.有人可以帮忙吗?

我的development.log:

Started GET "/" for 72.225.170.239 at 2012-06-29 15:28:43 -0700
Processing by HomeController#index as HTML
Rendered application/_logo.html.erb (0.6ms)
Rendered application/_navbar.html.erb (1.4ms)
Rendered home/index.html.erb within layouts/application (2.6ms)
Completed 500 Internal Server Error in 6ms

ActionView::Template::Error (application.css isn't precompiled):
2: <html>
3: <head>
4:   <title>Moving Mountains<%= get_title %></title>
5:   <%= stylesheet_link_tag    "application",:media => "all" %>
6:   <%= javascript_include_tag "application" %>
7:   <%= csrf_meta_tags %>
8:
app/views/layouts/application.html.erb:5:in `_app_views_layouts_application_html_erb___2841110860658336572_129641540'
app/controllers/home_controller.rb:6:in `index'

按要求,跑了

rake assets:precompile --trace RAILS_ENV=production
    touch /tmp/restart.txt

但仍然是同样的错误.以下是跟踪所说的内容:

newguy@mvngmtns:/var/www/movingmountains$rake assets:precompile --trace RAILS_ENV=production
** Invoke assets:precompile (first_time)
** Execute assets:precompile
/usr/local/rvm/rubies/ruby-1.9.2-head/bin/ruby /usr/local/rvm/gems/ruby-1.9.2-head@global/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets --trace
** Invoke assets:precompile:all (first_time)
** Execute assets:precompile:all
** Invoke assets:precompile:primary (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
** Invoke tmp:cache:clear (first_time)
** Execute tmp:cache:clear
** Execute assets:precompile:primary
** Invoke assets:precompile:nondigest (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
** Invoke tmp:cache:clear (first_time)
** Execute tmp:cache:clear
** Execute assets:precompile:non digest

在浏览器中我仍然有相同的“500 – 我们很抱歉,但出了点问题”,缓存:apache日志文件中的[GET /]未命中.

解决方法

设定后

config.assets.compile = true

你还应该运行:

rake assets:precompile --trace RAILS_ENV=production

见:rails 3.1.0 ActionView::Template::Error (application.css isn’t precompiled)

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读