我在rails 4.2应用程序上,当我将它查看到浏览器时我只得到空白页面,奇怪的是所有路由都有效,但它们都会导致空白页面,这是我得到的:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" media="all" href="https://d2m2v9ix6oa4mz.cloudfront.net/assets/application-5ea496b2544e770dd32eddc798ebe844.css" />
<script src="https://d2m2v9ix6oa4mz.cloudfront.net/assets/application-2020c3d1d37b4e77942c8d4b54d4b790.js"></script>
<meta name="csrf-param" content="authenticity_token" />
<meta name="csrf-token" content="PMSfAv88XZbAbSebUIfNCWS+aeesawxSz40C19iy1ze1ddR/htclFSd4CP/xkpAVR4hHUh1hVs3QkkOsHTQTVg==" />
</head>
<body>
<style>
.span7
{
width:550px;
}
.myContainer
{
width: 1050px;
margin-right: auto;
margin-left: auto
}
.h2{
margin-left:100px;
}
.btn.jumbo {
font-size: 21px;
line-height: normal;
padding: 9px 14px 9px;
-webkit-border-radius: 6px;
-moz-border-radius: 6px;
border-radius: 6px;
}
</style>
</body>
</html>
以下是我启动应用的方式:
# rails s -e production
=> Booting WEBrick
=> Rails 4.2.0 application starting in production on http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
DEPRECATION WARNING: The configuration option `config.serve_static_assets` has been renamed to `config.serve_static_files` to clarify its role (it merely enables serving everything in the `public` folder and is unrelated to the asset pipeline). The `serve_static_assets` alias will be removed in Rails 5.0. Please migrate your configuration files accordingly. (called from block in <top (required)> at /var/www/web.com/config/environments/production.rb:26)
[2015-03-21 16:36:31] INFO WEBrick 1.3.1
[2015-03-21 16:36:31] INFO ruby 2.2.1 (2015-02-26) [x86_64-linux]
[2015-03-21 16:36:31] INFO WEBrick::HTTPServer#start: pid=24129 port=3000
如何知道发生了什么?有什么问题?!
答案 0 :(得分:0)
您可能需要编译资产。
运行:
RAILS_ENV=production bundle exec rake assets:precompile
在生产服务器上,然后试一试。
您可以在本地执行此操作并推送到您的VPS。
答案 1 :(得分:0)
所以不确定这是不是你的问题,但我遇到了同样的问题,结果是我评论了_header.html.erb
文件中的最后几行html,但是没有关闭评论{ {1}},因此它有效地评论了我页面上的所有代码,留下了空白页面。愚蠢的错误。