Redmine 3.3.0(ruby on rails 4.2.6)样式表未在application.css中生成/包含

时间:2016-09-15 22:41:13

标签: css ruby ruby-on-rails-3 redmine

我已经安装了redmine,设法启动它但是UI似乎缺少它的css样式。如果我按照应用程序的链接[SomeId] .css它显示一个包含以下消息的空css:

 /*
 * This is a manifest file that'll be compiled into application.css, which will include all the files
 * listed below.
 *
 * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
 * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
 *
 * You're free to add application-wide styles to this file and they'll appear at the bottom of the
 * compiled file so the styles you add here take precedence over styles defined in any styles
 * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
 * file per style scope.
 *
 */

production.log 似乎很好

  Processing by WelcomeController#index as HTML
  Current user: anonymous
  Rendered welcome/index.html.erb within layouts/base (1.0ms)
Completed 200 OK in 18ms (Views: 9.4ms | ActiveRecord: 4.0ms)
Started GET "/assets/application-e80e8f2318043e8af94dddc2adad5a4f09739a8ebb323b3ab31cd71d45fd9113.css" for ::1 at 2016-09-16 01:34:36 +0300
Started GET "/assets/application-c2899b9307d416d19b1525a85be8085b93df756e91a5b0ee50ab1333f5ade73a.js" for ::1 at 2016-09-16 01:34:36 +0300

的.htaccess

<IfModule mod_fastcgi.c>
    AddHandler fastcgi-script .fcgi
</IfModule>
<IfModule mod_fcgid.c>
    AddHandler fcgid-script .fcgi
</IfModule>
Options +FollowSymLinks +ExecCGI

RewriteEngine On

RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
<IfModule mod_fastcgi.c>
    RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
</IfModule>
<IfModule mod_fcgid.c>
    RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
</IfModule>

ErrorDocument 500 "<h2>Application error</h2>Rails application failed to start properly"
  • redmine 3.3.0
  • ruby​​ 2.2.4
  • rails 4.2.6
  • 最新xampp xampp-win32-7.0.9-1-VC14-installer

有关如何解决这个问题的想法吗?

1 个答案:

答案 0 :(得分:0)

显然我的错误是我在开发模式下根本没有运行'Redmine'。据我所知,直到现在,还没有启动rails资产管道上的ruby以生成连接的application.css。我所要做的就是在开发模式下运行一次服务器。

rake assets:precompile
rails server -e development

此答案中还找到了一些有用的信息:Rails assets not precompiling, css looks different in productionRails 4: assets not loading in production

这是我第一次遇到RoR,我盲目地遵循了“Redmine”的安装教程,但没有包含编译步骤。

修改 问题又回来了,实际上它甚至没有得到妥善修复。必须解决mysql2适配器和登录凭据的一些问题才能正确填充数据库。之后我尝试了很多东西,直到最后到达这个步骤列表:

environments / production.rb

中添加
config.serve_static_files = true
config.assets.compile = true
config.assets.precompile =  ['*.js', '*.css', '*.css.erb'] 
config.assets.digest = true
  • 杀死服务器
  • 清除tmp / cache / assets
  • 删除公共/资产
  • 运行rake资产:预编译
  • 启动服务器rails s -e production
  • 重新加载页面

在cmd中运行:

set RAILS_ENV=production
rake generate_secret_token

set RAILS_ENV=production
rake db:migrate

set RAILS_ENV=production
rake redmine:load_default_data

set RAILS_ENV=production
rake tmp:cache:clear

set RAILS_ENV=production
rake assets:precompile

set RAILS_ENV=production
rails server -e development

如果我访问了该页面并打开了网络检查员,当我点击application.css的elink时,我仍然得到空的.css

最终我发现相反,gziped版本的大小为1kb,这很有趣。我删除它和VOILA,它工作。基本上我解决了我的问题,但我仍然不知道为什么用空css生成gzip。