Heroku:您要查找的页面不存在

utn*_*nas 3 ruby-on-rails heroku

当我尝试将我的应用程序部署到Heroku时,我收到此错误.在我做之前,我的第一次部署工作正常heroku run rake db:reset.在此之后,我有以下错误:"我们很抱歉,但出了点问题." 和"您正在寻找的页面不存在.您可能输错了地址或页面可能已移动."

我的heroku日志说:

2012-12-08T11:40:54+00:00 app[web.1]: ActionView::Template::Error (bootstrap.css isn't precompiled):
2012-12-08T11:40:54+00:00 app[web.1]:     9:   <%= csrf_meta_tags %>
2012-12-08T11:40:54+00:00 app[web.1]: 
2012-12-08T11:40:54+00:00 app[web.1]:     8:   <%= javascript_include_tag "bootstrap", media: "all"%>
Run Code Online (Sandbox Code Playgroud)

有一个,你能帮助我吗?

Lyu*_*rov 11

看起来Heroku抱怨您的资产未经过预编译.我通过本教程阅读了关于heroku的rails,有一节专门介绍资源预编译.

您可以告诉您的应用程序在生产中预编译资产

#config/environments/production.rb
config.assets.compile = true
# Heroku also requires this to be false
config.assets.initialize_on_precompile=false
Run Code Online (Sandbox Code Playgroud)

或者,您可以使用rake任务预编译资产

#before pushing to Heroku and then you can push
rake assets:precompile

#or after you've pushed to heroku
heroku run rake assets:precompile
Run Code Online (Sandbox Code Playgroud)