在本地生产模式下运行rails

Kop*_*lyf 5 ruby-on-rails production-environment

我正在尝试使用以下命令在生产模式下运行rails(不太了解它):

rails server -e production
Run Code Online (Sandbox Code Playgroud)

但是我在控制台和丑陋的页面中收到这些错误而没有加载css:

Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://10.20.200.199:3000/".
(index):1 Refused to execute script from 'http://10.20.200.199:3000/javascripts/application.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
(index):1 Refused to execute script from 'http://10.20.200.199:3000/logins/plugins.js?v=1' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
Run Code Online (Sandbox Code Playgroud)

这种情况发生在我们正在使用的所有脚本中.

有人可以帮我解决这里可能出错的问题.

提前致谢.

ign*_*eus 4

对于使用生产环境预构建资产运行:rake assets:precompile

所描述的错误表明浏览器请求静态资源;这些不是构建的(它们不会在生产中自动构建 - 您应该在每次部署时构建它们),因此在它们的 URL 中找不到任何内容,而是呈现错误页面。因此,浏览器错误提示下载的 css 和 javascript 文件的 MIME 类型错误。