gpt4 book ai didi

ruby-on-rails - Heroku 上的 Rails 3.1.3 : (No route matches [GET] "/assets/rails.png")

转载 作者:行者123 更新时间:2023-12-03 18:15:06 25 4
gpt4 key购买 nike

我已经在 Heroku 上安装了一些基本的应用程序,没有问题,这个(Rails 3.1.3)看起来不错,因为它显示了 Rails 欢迎页面

public/index.html.erb

但是当我删除该页面然后设置
root :to => 'users#index'

我有问题。在 heroku 日志中,它说存在路由错误
ActionController::RoutingError (No route matches [GET] "/assets/rails.png"):

有谁知道这是关于什么的?
2012-01-14T21:48:29+00:00 heroku[web.1]: Process exited
2012-01-14T21:48:33+00:00 app[web.1]: >> Thin web server (v1.2.6 codename Crazy Delicious)
2012-01-14T21:48:33+00:00 app[web.1]: >> Maximum connections set to 1024
2012-01-14T21:48:33+00:00 app[web.1]: >> Listening on 0.0.0.0:32570, CTRL+C to stop
2012-01-14T21:48:34+00:00 heroku[web.1]: State changed from starting to up
2012-01-14T21:48:35+00:00 app[web.1]: cache: [GET /] miss
2012-01-14T21:48:36+00:00 app[web.1]:
2012-01-14T21:48:36+00:00 app[web.1]:
2012-01-14T21:48:36+00:00 app[web.1]: Started GET "/assets/rails.png" for 216.251.147.10 at 2012-01-14 13:48:36 -0800
2012-01-14T21:48:36+00:00 app[web.1]:
2012-01-14T21:48:36+00:00 app[web.1]: ActionController::RoutingError (No route matches [GET] "/assets/rails.png"):
2012-01-14T21:48:36+00:00 app[web.1]:
2012-01-14T21:48:36+00:00 app[web.1]:
2012-01-14T21:48:36+00:00 app[web.1]:
2012-01-14T21:48:36+00:00 app[web.1]: cache: [GET /assets/rails.png] miss
2012-01-14T21:48:35+00:00 heroku[router]: GET mmcarrier.heroku.com/ dyno=web.1 queue=0 wait=0ms service=19ms status=200 bytes=5907
2012-01-14T21:48:36+00:00 heroku[router]: GET mmcarrier.heroku.com/assets/rails.png dyno=web.1 queue=0 wait=0ms service=30ms status=404 bytes=728
2012-01-14T21:48:46+00:00 app[web.1]: cache: [GET /] miss
2012-01-14T21:48:46+00:00 app[web.1]:
2012-01-14T21:48:46+00:00 app[web.1]:
2012-01-14T21:48:46+00:00 app[web.1]: Started GET "/assets/rails.png" for 216.251.147.10 at 2012-01-14 13:48:46 -0800
2012-01-14T21:48:46+00:00 app[web.1]:
2012-01-14T21:48:46+00:00 app[web.1]: ActionC

2012-01-14T21:48:46+00:00 app[web.1]:
2012-01-14T21:48:46+00:00 app[web.1]:
2012-01-14T21:48:46+00:00 app[web.1]:
2012-01-14T21:48:46+00:00 app[web.1]: cache: [GET /assets/rails.png] miss
2012-01-14T21:48:46+00:00 app[web.1]: cache: [GET /favicon.ico] miss
2012-01-14T21:48:46+00:00 heroku[router]: GET mmcarrier.heroku.com/favicon.ico dyno=web.1 queue=0 wait=0ms service=3ms status=200 bytes=0
2012-01-14T21:48:46+00:00 heroku[router]: GET mmcarrier.heroku.com/ dyno=web.1 queue=0 wait=0ms service=6ms status=200 bytes=5907
2012-01-14T21:48:46+00:00 heroku[router]: GET mmcarrier.heroku.com/assets/rails.png dyno=web.1 queue=0 wait=0ms service=4ms status=404 bytes=728
2012-01-14T21:48:59+00:00 app[web.1]: cache: [GET /] miss
2012-01-14T21:48:59+00:00 heroku[router]: GET mmcarrier.heroku.com/ dyno=web.1 queue=0 wait=0ms service=5ms status=200 bytes=5907
2012-01-14T21:48:59+00:00 app[web.1]:
2012-01-14T21:48:59+00:00 app[web.1]:
2012-01-14T21:48:59+00:00 app[web.1]: Started GET "/assets/rails.png" for 216.251.147.10 at 2012-01-14 13:48:59 -0800
2012-01-14T21:48:59+00:00 app[web.1]:
2012-01-14T21:48:59+00:00 app[web.1]: ActionController::RoutingError (No route matches [GET] "/assets/rails.png"):
2012-01-14T21:48:59+00:00 app[web.1]:
2012-01-14T21:48:59+00:00 app[web.1]:
2012-01-14T21:48:59+00:00 app[web.1]:
2012-01-14T21:48:59+00:00 app[web.1]: cache: [GET /assets/rails.png] miss
2012-01-14T21:48:59+00:00 heroku[router]: GET mmcarrier.heroku.com/assets/rails.png dyno=web.1 queue=0 wait=0ms service=3ms status=404 bytes=728
2012-01-14T21:49:18+00:00 app[web.1]:
2012-01-14T21:49:18+00:00 app[web.1]:
2012-01-14T21:49:18+00:00 app[web.1]: Started GET "/assets/rails.png" for 216.251.147.10 at 2012-01-14 13:49:18 -0800
2012-01-14T21:49:18+00:00 app[web.1]:
2012-01-14T21:49:18+00:00 app[web.1]: ActionController::RoutingError (No route matches [GET] "/assets/rails.png"):
2012-01-14T21:49:18+00:00 app[web.1]:
2012-01-14T21:49:18+00:00 app[web.1]:
2012-01-14T21:49:18+00:00 app[web.1]:
2012-01-14T21:49:18+00:00 app[web.1]: cache: [GET /assets/rails.png] miss
2012-01-14T21:49:18+00:00 heroku[router]: GET mmcarrier.heroku.com/assets/rails.png dyno=web.1 queue=0 wait=0ms service=4ms status=404 bytes=728
2012-01-14T21:49:33+00:00 app[web.1]: cache: [GET /] miss
2012-01-14T21:49:33+00:00 app[web.1]:
2012-01-14T21:49:33+00:00 app[web.1]:
2012-01-14T21:49:33+00:00 app[web.1]: Started GET "/assets/rails.png" for 216.251.147.10 at 2012-01-14 13:49:33 -0800
2012-01-14T21:49:33+00:00 app[web.1]:
2012-01-14T21:49:33+00:00 app[web.1]: ActionController::RoutingError (No route matches [GET] "/assets/rails.png"):
2012-01-14T21:49:33+00:00 app[web.1]:
2012-01-14T21:49:33+00:00 app[web.1]:
2012-01-14T21:49:33+00:00 app[web.1]: cache: [GET /assets/rails.png] miss
2012-01-14T21:49:33+00:00 app[web.1]:
2012-01-14T21:49:34+00:00 app[web.1]: cache: [GET /favicon.ico] miss
2012-01-14T21:49:33+00:00 heroku[router]: GET mmcarrier.heroku.com/ dyno=web.1 queue=0 wait=0ms service=6ms status=200 bytes=5907
2012-01-14T21:49:33+00:00 heroku[router]: GET mmcarrier.heroku.com/assets/rails.png dyno=web.1 queue=0 wait=0ms service=4ms status=404 bytes=728
2012-01-14T21:49:34+00:00 heroku[router]: GET mmcarrier.heroku.com/favicon.ico dyno=web.1 queue=0 wait=0ms service=3ms status=200 bytes=0
2012-01-14T21:50:21+00:00 app[web.1]: cache: [GET /] miss
2012-01-14T21:50:21+00:00 heroku[router]: GET mmcarrier.heroku.com/ dyno=web.1 queue=0 wait=0ms service=4ms status=200 bytes=5907
2012-01-14T21:50:21+00:00 app[web.1]:
2012-01-14T21:50:21+00:00 heroku[router]: GET mmcarrier.heroku.com/assets/rails.png dyno=web.1 queue=0 wait=0ms service=4ms status=404 bytes=728
2012-01-14T21:50:21+00:00 app[web.1]: Started GET "/assets/rails.png" for 216.251.147.10 at 2012-01-14 13:50:21 -0800
2012-01-14T21:50:21+00:00 app[web.1]:
2012-01-14T21:50:21+00:00 app[web.1]:
2012-01-14T21:50:21+00:00 app[web.1]: cache: [GET /assets/rails.png] miss
2012-01-14T21:50:21+00:00 app[web.1]: ActionController::RoutingError (No route matches [GET] "/assets/rails.png"):
2012-01-14T21:50:21+00:00 app[web.1]:
2012-01-14T21:50:21+00:00 app[web.1]:
2012-01-14T21:50:21+00:00 app[web.1]:
2012-01-14T21:52:42+00:00 heroku[slugc]: Slug compilation started
2012-01-14T21:52:54+00:00 heroku[api]: Deploy 983a24d by m73mitchell@gmail.com
2012-01-14T21:52:54+00:00 heroku[api]: Release v8 created by m73mitchell@gmail.com
2012-01-14T21:52:54+00:00 heroku[web.1]: State changed from up to bouncing
2012-01-14T21:52:54+00:00 heroku[web.1]: State changed from bouncing to created
2012-01-14T21:52:54+00:00 heroku[web.1]: State changed from created to starting
2012-01-14T21:52:55+00:00 heroku[slugc]: Slug compilation finished
2012-01-14T21:53:01+00:00 heroku[web.1]: State changed from starting to up
2012-01-14T21:53:05+00:00 heroku[router]: GET mmcarrier.heroku.com/assets/rails.png dyno=web.1 queue=0 wait=0ms service=37ms status=404 bytes=728
2012-01-14T21:53:17+00:00 heroku[router]: GET mmcarrier.heroku.com/assets/rails.png dyno=web.1 queue=0 wait=0ms service=5ms status=404 bytes=728
2012-01-14T21:53:36+00:00 heroku[router]: GET mmcarrier.heroku.com/assets/rails.png dyno=web.1 queue=0 wait=0ms service=2ms status=404 bytes=728
2012-01-14T21:53:38+00:00 heroku[router]: GET mmcarrier.heroku.com/ dyno=web.1 queue=0 wait=0ms service=107ms status=500 bytes=728
2012-01-14T21:53:40+00:00 heroku[router]: GET mmcarrier.heroku.com/ dyno=web.1 queue=0 wait=0ms service=20ms status=500 bytes=728
2012-01-14T21:53:49+00:00 heroku[run.1]: State changed from created to starting
2012-01-14T21:53:52+00:00 heroku[run.1]: State changed from starting to up
2012-01-14T21:53:57+00:00 heroku[run.1]: State changed from up to complete
2012-01-14T21:53:57+00:00 heroku[run.1]: Process exited
2012-01-14T21:55:15+00:00 heroku[router]: GET mmcarrier.heroku.com/assets/rails.png dyno=web.1 queue=0 wait=0ms service=35ms status=404 bytes=728
2012-01-14T21:55:17+00:00 heroku[router]: GET mmcarrier.heroku.com/assets/rails.png dyno=web.1 queue=0 wait=0ms service=3ms status=404 bytes=728
2012-01-14T21:55:22+00:00 heroku[router]: GET mmcarrier.heroku.com/ dyno=web.1 queue=0 wait=0ms service=12ms status=500 bytes=728
2012-01-14T21:56:18+00:00 heroku[router]: GET mmcarrier.heroku.com/ dyno=web.1 queue=0 wait=0ms service=12ms status=500 bytes=728

最佳答案

无需预编译 把你的 git 弄得一团糟!

heroku 将预编译您的 Assets

带 rails 3.1.x 您将此添加到 application.rb

config.assets.initialize_on_precompile = false

2012 年 7 月 16 日更新

还有 rails 3.2.x

ActiveRecord 和 database.yml 似乎有问题!如果您不使用常规数据库,而是使用 MongoDB,则不需要上述内容。但是,如果这样做,则需要禁用初始化,因为 activerecord 在初始化时读取数据库表,但数据库在 heroku 的预编译阶段不可用。

MongoDB 没有必要 .

/更新

rails 3.2.x
: 看顶部 application.rb . OMA 评论是我的,为清楚起见添加
if defined?(Bundler)
# If you precompile assets before deploying to production, use this line
"OMA - comment this line"
#Bundler.require(*Rails.groups(:assets => %w(development test)))
# If you want your assets lazily compiled in production, use this line
"OMA - uncomment this line"
Bundler.require(:default, :assets, Rails.env)
end

关于ruby-on-rails - Heroku 上的 Rails 3.1.3 : (No route matches [GET] "/assets/rails.png"),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8865712/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com