我在/ app / assets / javascripts和/ app / assets / stylesheets下添加了必要的文件,并将我的工作index.html.erb文件更改为:
index.html.erb
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<link rel="stylesheet" type="text/css" href="/app/assets/stylesheets/styles.css">
<link rel="stylesheet" type="text/css" href="/app/assets/stylesheets/colorbox.css">
<link rel="stylesheet" type="text/css" href="/app/assets/stylesheets/style.css">
<meta name="description" content="">
<meta name="author" content="">
<title>Customer Analysis | Welcome</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity="sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r" crossorigin="anonymous">
</head>
<body>
<div id="main-container">
<div id="content">
<div id="menu">
<a href="http://customers.priceanalytics.net/">Home</a>
</div>
<div class="container">
<h2>Customer Analysis</h2>
<div class="row">
<ul class="nav nav-tabs" id="tab">
<li class="active" role="presentation">
<a href="#dashboard">Retention</a>
</li>
<li class="" role="presentation">
<a href="#experiments">Cohort</a>
</li>
<li class="" role="presentation">
<a href="#clv">Customer Lifetime Value</a>
</li>
<li class="" role="presentation">
<a href="#mapped">Map</a>
</li>
<li class="" role="filter">
<a href="#filter">Customer Audiences</a>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane fade active in" id="dashboard">
<div class="row" id="retention"></div>
</div>
<div class="tab-pane fade" id="experiments">
<center>
<h2>Sales</h2>
</center>
<div class="row" id="cohorttable"></div>
</div>
<div id="filter" class="tab-pane fade">
<center><h2>Customer Audiences</h2></center>
<div id="crossfilter" class="row">
<div id="leftpane">
<div id="propertylist"></div>
<button class="btn btn-primary">Save data</button>
</div>
<div id="rightpane">
<div id="charts"></div>
<aside id="totals"><span id="active">-</span> of <span id="total">-</span> customers fit the above criteria.</aside>
<div id="lists">
<table class="customer-list">
<tr class="customer">
<td class="shippingname">Shipping name</td>
<td class="e-mail">e-mail</td>
<td class="time">First date</td>
<td class="time">Last date</td>
<td class="currency">Total sales</td>
<td class="currency">NPV</td>
<td class="currency">AOV</td>
<td class="smallnumber">Orders</td>
<td class="smallnumber">Items</td>
<td class="time">Time btw</td>
<td class="zipcode">ZIP</td>
<td class="gender">Gender</td>
</tr>
</table>
<table id="customer-list" class="customer-list list"></table>
</div>
</div>
</div>
</div>
<div class="tab-pane fade" id="clv">
<center>
<h2>Customer Lifetime Value</h2>
</center>
<div class="row" id="clv">
<div class="col-sm-1"></div>
<div class="col-md-2"><p>Repeat Customer Rate:</p><p><span cmd="repeat_cust_rate"></span>%</p></div>
<div class="col-md-2"><p>Average Order Value:</p><p>$<span cmd="avg_order_val"></span></p></div>
<div class="col-md-2"><p>Time Between Purchases:</p><p><span cmd="time_btw_purchase"></span></p></div>
<div class="col-md-2"><p>Purchase Frequency:</p><p><span cmd="purchase_frequency"></span></p></div>
<div class="col-md-2"><p>Customer Value:</p><p>$<span cmd="cust_value"></span></p></div>
<div class="col-sm-1"></div>
<script>
var lifetimeValues = $('#clv').find('.col-md-2 span');
lifetimeValues.each( function(){
$(this).html( clv_data[0][ $(this).attr('cmd') ].toFixed(2) );
});
</script>
</div>
</div>
<div class="tab-pane fade" id="mapped">
<div class="row" id="map"></div>
</div>
</div>
</div>
</div>
<div id="popup">
<table></table>
</div>
<div id="selectioninfo">
<table></table><button id="savedata" class="btn btn-primary">Save data</button>
</div>
<script src=
"https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js">
</script>
<script src=
"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js">
</script>
<script type="text/javascript">
$(function() {
$('#tab a').click(function(e) {
e.preventDefault();
$(this).tab('show');
});
});
</script>
<script src="/app/assets/javascripts/jquery-1.js" type="text/javascript">
</script>
<script src="/app/assets/javascripts/bootstrap.js" type="text/javascript">
</script>
<script src="/app/assets/javascripts/jquery.js" type="text/javascript">
</script>
<script src="https://d3js.org/topojson.v1.min.js">
</script>
<script src="/app/assets/javascripts/sorttable.js" type="text/javascript">
</script>
<script src="/app/assets/javascripts/d3.min.js" type="text/javascript">
</script>
<script src="/app/assets/javascripts/FileSaver.min.js" type="text/javascript">
</script>
<script src="/app/assets/javascripts/crossfilter.v1.min.js">
</script>
<script src="/app/assets/javascripts/retention.js">
</script>
<script src="/app/assets/javascripts/cohort.js">
</script>
<script src="/app/assets/javascripts/map.js">
</script>
<script src="/app/assets/javascripts/filter.js">
</script>
<script type="text/javascript">
$(function() {
$('#tab a').click(function(e) {
e.preventDefault();
$(this).tab('show');
});
});
</script>
<script type="text/javascript">
$(function() {
$('#tab a').click(function(e) {
e.preventDefault();
$(this).tab('show');
});
});
</script>
</div>
</div>
</body>
当推送到heroku时,我收到错误:
remote: ! Precompiling assets failed.
remote: !
remote: ! Push rejected, failed to compile Ruby app.
remote:
remote: ! Push failed
我仍然需要在Ruby中添加一些变量,但我认为这应该可行。我对Rails很新,有没有更好的方法来设置html页面?我之前在这个应用程序的Python版本上使用过此代码。
Heroku Log
2016-10-10T20:12:20.148407+00:00 heroku[slug-compiler]: Slug compilation started
2016-10-10T20:12:20.148413+00:00 heroku[slug-compiler]: Slug compilation finished
2016-10-10T20:12:20.278402+00:00 heroku[web.1]: Restarting
2016-10-10T20:12:20.278949+00:00 heroku[web.1]: State changed from up to starting
2016-10-10T20:12:22.031227+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2016-10-10T20:12:22.428123+00:00 app[web.1]: [2016-10-10 20:12:22] FATAL SignalException: SIGTERM
2016-10-10T20:12:22.428134+00:00 app[web.1]: /app/vendor/ruby-2.2.4/lib/ruby/2.2.0/webrick/server.rb:174:in `select'
2016-10-10T20:12:22.428135+00:00 app[web.1]: /app/vendor/ruby-2.2.4/lib/ruby/2.2.0/webrick/server.rb:174:in `block in
start'
2016-10-10T20:12:22.428136+00:00 app[web.1]: /app/vendor/ruby-2.2.4/lib/ruby/2.2.0/webrick/server.rb:32:in `start'
2016-10-10T20:12:22.428136+00:00 app[web.1]: /app/vendor/ruby-2.2.4/lib/ruby/2.2.0/webrick/server.rb:162:in `start'
2016-10-10T20:12:22.428137+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.4/lib/rack/handler/webrick.r
b:34:in `run'
2016-10-10T20:12:22.428138+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.4/lib/rack/server.rb:286:in
`start'
2016-10-10T20:12:22.428138+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.5.1/lib/rails/commands/s
erver.rb:80:in `start'
2016-10-10T20:12:22.428142+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.5.1/lib/rails/commands/c
ommands_tasks.rb:80:in `block in server'
2016-10-10T20:12:22.428144+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.5.1/lib/rails/commands/c
ommands_tasks.rb:75:in `tap'
2016-10-10T20:12:22.428145+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.5.1/lib/rails/commands/c
ommands_tasks.rb:75:in `server'
2016-10-10T20:12:22.428146+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.5.1/lib/rails/commands/c
ommands_tasks.rb:39:in `run_command!'
2016-10-10T20:12:22.428146+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.5.1/lib/rails/commands.r
b:17:in `<top (required)>'
2016-10-10T20:12:22.428147+00:00 app[web.1]: bin/rails:4:in `require'
2016-10-10T20:12:22.428148+00:00 app[web.1]: bin/rails:4:in `<main>'
2016-10-10T20:12:22.428306+00:00 app[web.1]: [2016-10-10 20:12:22] INFO going to shutdown ...
2016-10-10T20:12:22.428392+00:00 app[web.1]: [2016-10-10 20:12:22] INFO WEBrick::HTTPServer#start done.
2016-10-10T20:12:22.466742+00:00 app[web.1]: => Booting WEBrick
2016-10-10T20:12:22.466746+00:00 app[web.1]: => Rails 4.2.5.1 application starting in production on http://0.0.0.0:24845
2016-10-10T20:12:22.466747+00:00 app[web.1]: => Run `rails server -h` for more startup options
2016-10-10T20:12:22.466748+00:00 app[web.1]: => Ctrl-C to shutdown server
2016-10-10T20:12:22.466749+00:00 app[web.1]: Exiting
2016-10-10T20:12:22.573198+00:00 heroku[web.1]: Process exited with status 143
2016-10-10T20:12:23.456119+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 38099 -e production`
2016-10-10T20:12:27.186333+00:00 app[web.1]: [2016-10-10 20:12:27] INFO WEBrick 1.3.1
2016-10-10T20:12:27.186387+00:00 app[web.1]: [2016-10-10 20:12:27] INFO ruby 2.2.4 (2015-12-16) [x86_64-linux]
2016-10-10T20:12:27.186771+00:00 app[web.1]: [2016-10-10 20:12:27] INFO WEBrick::HTTPServer#start: pid=3 port=38099
2016-10-10T20:12:27.581049+00:00 heroku[web.1]: State changed from starting to up
2016-10-10T20:13:15.340999+00:00 heroku[router]: at=info method=GET path="/?hmac=b0022c2db596e836cdda8c136ee40b9f30f1333
b30f9bd86c06ee6e344096f0f&protocol=https%3A%2F%2F&shop=test-cust.myshopify.com×tamp=1476130393" host=shop-test-2.he
rokuapp.com request_id=442d86b3-025d-46f9-9687-a6ee20384685 fwd="71.239.189.250" dyno=web.1 connect=1ms service=669ms st
atus=200 bytes=5014
2016-10-10T20:13:15.322516+00:00 app[web.1]: unknown OID 2278: failed to recognize type of 'retention_data'. It will be
treated as String.
2016-10-10T20:45:47.821178+00:00 heroku[slug-compiler]: Slug compilation started
2016-10-10T20:46:03.679549+00:00 heroku[router]: at=info method=GET path="/?hmac=a311893f64b3cb8689c24c1bdd962bcc1bede1e
258b538982bdf883595ca76e3&protocol=https%3A%2F%2F&shop=test-cust.myshopify.com×tamp=1476132362" host=shop-test-2.he
rokuapp.com request_id=40dc5c2f-21ba-4ae7-9051-be7ff9d05eac fwd="71.239.189.250" dyno=web.1 connect=11ms service=413ms s
tatus=200 bytes=5014
2016-10-10T20:46:48.233219+00:00 heroku[slug-compiler]: Slug compilation started
2016-10-10T20:47:29.144311+00:00 heroku[web.1]: Idling
2016-10-10T20:47:29.145034+00:00 heroku[web.1]: State changed from up to down
2016-10-10T20:47:31.536543+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2016-10-10T20:47:32.209321+00:00 app[web.1]: [2016-10-10 20:47:32] FATAL SignalException: SIGTERM
2016-10-10T20:47:32.209331+00:00 app[web.1]: /app/vendor/ruby-2.2.4/lib/ruby/2.2.0/webrick/server.rb:174:in `select'
2016-10-10T20:47:32.209334+00:00 app[web.1]: /app/vendor/ruby-2.2.4/lib/ruby/2.2.0/webrick/server.rb:174:in `block in
start'
2016-10-10T20:47:32.209335+00:00 app[web.1]: /app/vendor/ruby-2.2.4/lib/ruby/2.2.0/webrick/server.rb:32:in `start'
2016-10-10T20:47:32.209335+00:00 app[web.1]: /app/vendor/ruby-2.2.4/lib/ruby/2.2.0/webrick/server.rb:162:in `start'
2016-10-10T20:47:32.209336+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.4/lib/rack/handler/webrick.r
b:34:in `run'
2016-10-10T20:47:32.209336+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.4/lib/rack/server.rb:286:in
`start'
2016-10-10T20:47:32.209337+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.5.1/lib/rails/commands/s
erver.rb:80:in `start'
2016-10-10T20:47:32.209338+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.5.1/lib/rails/commands/c
ommands_tasks.rb:80:in `block in server'
2016-10-10T20:47:32.209339+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.5.1/lib/rails/commands/c
ommands_tasks.rb:75:in `tap'
2016-10-10T20:47:32.209339+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.5.1/lib/rails/commands/c
ommands_tasks.rb:75:in `server'
2016-10-10T20:47:32.209340+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.5.1/lib/rails/commands/c
ommands_tasks.rb:39:in `run_command!'
2016-10-10T20:47:32.209340+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.5.1/lib/rails/commands.r
b:17:in `<top (required)>'
2016-10-10T20:47:32.209341+00:00 app[web.1]: bin/rails:4:in `require'
2016-10-10T20:47:32.209342+00:00 app[web.1]: bin/rails:4:in `<main>'
2016-10-10T20:47:32.209424+00:00 app[web.1]: [2016-10-10 20:47:32] INFO going to shutdown ...
2016-10-10T20:47:32.209467+00:00 app[web.1]: [2016-10-10 20:47:32] INFO WEBrick::HTTPServer#start done.
2016-10-10T20:47:32.243638+00:00 app[web.1]: => Booting WEBrick
2016-10-10T20:47:32.243644+00:00 app[web.1]: => Run `rails server -h` for more startup options
2016-10-10T20:47:32.243643+00:00 app[web.1]: => Rails 4.2.5.1 application starting in production on http://0.0.0.0:38099
2016-10-10T20:47:32.243644+00:00 app[web.1]: => Ctrl-C to shutdown server
2016-10-10T20:47:32.243645+00:00 app[web.1]: Exiting
2016-10-10T20:47:32.356245+00:00 heroku[web.1]: Process exited with status 143
2016-10-10T20:51:09.010661+00:00 heroku[slug-compiler]: Slug compilation started
答案 0 :(得分:2)
我要拖出陈词滥调,但我认为这是适用的:
“相关并不意味着因果关系。”
您可能在遇到此异常之前已将资产添加到Rails项目中,但这并不意味着这些资产是异常的原因。 SIGTERM
是源自项目外部的UNIX信号,或多或少归结为“请关闭”。通过这样做,您的应用程序可以慷慨地满足此要求。
Heroku dyno manager可能是此信号的来源。如果您正在使用Heroku的免费套餐,由于该级别的dynos必须有睡眠时间,您将不时遇到此问题。
尝试运行:
重新启动工作人员dynoheroku restart worker.1
关于这个问题并非来自dyno经理,请尝试将您的网络服务器更改为生产等级产品。 Heroku特别cautions against using WEBrick,可以用于开发,但对生产来说不太好。虽然您目前可能正处于开发阶段,但您可能希望咬紧牙关并使用与最终将在生产中运行的相同设置。
我不认为WEBrick在这里是个问题,但你现在可能会把你的鸭子连在一起而不是以后。