public/assets 目录为空,网站显示缺少CSS和JavaScript 的样子,怎么办?
机器为 freebsd ,使用 pkg 安装 redmine61 之后,public/assets 目录为空。
在 /usr/local/www/redmine 目录下运行 bundle exec rails server -e production 后,打开网站如图所示。
请教如何搞?
回复 (4)
RE: public/assets 目录为空,网站显示缺少CSS和JavaScript 的样子,怎么办?
-
由 hong xing 在 4 个月 之前添加
@zheng abu 写到:
机器为 freebsd ,使用 pkg 安装 redmine61 之后,public/assets 目录为空。
在 /usr/local/www/redmine 目录下运行 bundle exec rails server -e production 后,打开网站如图所示。
请教如何搞?
RE: public/assets 目录为空,网站显示缺少CSS和JavaScript 的样子,怎么办?
-
由 zheng abu 在 4 个月 之前添加
感谢,就是这个命令 bundle exec rake assets:precompile RAILS_ENV=production,不知道什么功能。
没接触过ruby,一开始看到介绍就想试试 redmine,以为类似 apache、mysql一样安装后简单地修改一下文本配置文件,结果花了大量时间学习 gem bundle 相关的东西,类似这条命令 RAILS_ENV=production bundle exec rake db:migrate 还没去了解它的规则功能,只是知道要运行它。
现在运行 bundle exec rails server -e production 能访问3000端口使用了,但如何与 nginx 结合呢?还没头绪。
RE: public/assets 目录为空,网站显示缺少CSS和JavaScript 的样子,怎么办?
-
由 hong xing 在 4 个月 之前添加
@zheng abu 在 RE: public/assets 目录为空,网站显示缺少CSS和JavaScript 的样子,怎么办? 中写到:
感谢,就是这个命令 bundle exec rake assets:precompile RAILS_ENV=production,不知道什么功能。
6. Compile assets
Compile the assets such as stylesheets, javascripts and images. This
generates the files into the public/assets directory for delivery by
the web server.
using:
bundle exec rake assets:precompile RAILS_ENV=“production”If deploying to a sub-uri, set the relative URL root as follows:
bundle exec rake assets:precompile RAILS_ENV=“production” RAILS_RELATIVE_URL_ROOT=/sub-uriIf you experience issues with missing assets in the browser, try
removing the public/assets directory before re-running the precompile:
bundle exec rake assets:clobber RAILS_ENV=“production”
该功能是手动编译资产,具体目录和使用方法在redmine目录的 doc/INSTALL有具体的说明 #41754
没接触过ruby,一开始看到介绍就想试试 redmine,以为类似 apache、mysql一样安装后简单地修改一下文本配置文件,结果花了大量时间学习 gem bundle 相关的东西,类似这条命令 RAILS_ENV=production bundle exec rake db:migrate 还没去了解它的规则功能,只是知道要运行它。
现在运行 bundle exec rails server -e production 能访问3000端口使用了,但如何与 nginx 结合呢?还没头绪。
redmine.org官方wiki有案例供参考 https://www.redmine.org/projects/redmine/wiki/HowTos