Redmine 3.3.0(ruby on rails 4.2.6)样式表不是 generated/included in application.css

Redmine 3.3.0 (ruby on rails 4.2.6) stylesheets not generated/included in application.css

我已经安装了 redmine,成功启动了,但是 UI 似乎缺少它的 css 样式。如果我按照 link for application[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 ^([^.]+)$ .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' 在开发模式下。据我了解,直到现在,rails 资产管道上的 ruby 并未启动以生成串联的 application.css。我所要做的就是 运行 服务器一次处于开发模式。

rake assets:precompile
rails server -e development

还在这个答案中找到了一些有用的信息:Rails assets not precompiling, css looks different in production and Rails 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
  • 删除public/assets
  • 运行 耙子 assets:precompile
  • 启动服务器railss -e production
  • 正在重新加载页面

运行 在命令中:

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

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

生成的