我在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
如何知道发生了什么?有什么问题吗?!
发布于 2015-03-21 23:44:37
您可能需要编译您的资产。
运行:
RAILS_ENV=production bundle exec rake assets:precompile
在生产服务器上,试一试。
您可以在本地执行此操作,并将其推送到您的VPS。
发布于 2016-11-22 13:01:45
所以我不确定这是不是你的问题,但我也有同样的问题,结果是我注释了_header.html.erb
文件中最后几行html代码,但没有关闭注释-->
,因此它有效地注释掉了我页面上的所有代码,留下了一个空白页面。愚蠢的错误。
https://stackoverflow.com/questions/29185294
复制相似问题