gpt4 book ai didi

ruby-on-rails - Rails Heroku 应用程序错误

转载 作者:行者123 更新时间:2023-11-29 11:37:55 27 4
gpt4 key购买 nike

我的项目在本地运行良好。我将它部署到 Heroku。我有一些错误,应用程序无法在那里运行。我在 postgresql 中使用 Rails 4。不明白为什么会这样。在我看来,数据库没有创建。我应该在我的 database.yml 上添加指定生产设置吗?

数据库.yml

development:
adapter: postgresql
encoding: utf8
database: test_store_dev
pool: 5
username: mike
password: mike
host: 127.0.0.1

test:
adapter: postgresql
encoding: utf8
database: test_store_test
pool: 5
username: mike
password: mike
host: 127.0.0.1

来自日志:

~/workspace/test_store$ heroku logs --tail
2014-02-13T13:14:47.731382+00:00 app[web.1]: 3:
2014-02-13T13:14:47.731535+00:00 app[web.1]: 6: <% Category.roots.each do |category| %>
2014-02-13T13:14:47.731382+00:00 app[web.1]: : SELECT "categories".* FROM "categories" WHERE "categories"."parent_id" IS NULL ORDER BY "categories"."lft"):
2014-02-13T13:14:47.731972+00:00 app[web.1]: I, [2014-02-13T13:13:06.802166 #2] INFO -- : Started GET "/" for 46.53.195.24 at 2014-02-13 13:13:06 +0000
2014-02-13T13:14:47.731828+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/application.rb:97:in `call'
2014-02-13T13:14:47.731972+00:00 app[web.1]: I, [2014-02-13T13:13:06.807361 #2] INFO -- : Rendered shared/_search_form.html.erb (0.6ms)
2014-02-13T13:14:47.731972+00:00 app[web.1]: E, [2014-02-13T13:13:06.810210 #2] ERROR -- : PG::UndefinedTable: ERROR: relation "categories" does not exist
2014-02-13T13:14:47.731972+00:00 app[web.1]: LINE 1: SELECT "categories".* FROM "categories" WHERE "categories"....
2014-02-13T13:14:47.731828+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/handler/webrick.rb:60:in `service'
2014-02-13T13:14:47.731972+00:00 app[web.1]: ^
2014-02-13T13:14:47.731972+00:00 app[web.1]: : SELECT "categories".* FROM "categories" WHERE "categories"."parent_id" IS NULL ORDER BY "categories"."lft"
2014-02-13T13:14:47.732116+00:00 app[web.1]: I, [2014-02-13T13:13:06.813303 #2] INFO -- : Rendered categories/index.html.erb within layouts/application (6.7ms)
2014-02-13T13:14:47.731972+00:00 app[web.1]: I, [2014-02-13T13:13:06.805622 #2] INFO -- : Processing by CategoriesController#index as HTML
2014-02-13T13:14:47.732116+00:00 app[web.1]: F, [2014-02-13T13:13:06.819692 #2] FATAL -- :
2014-02-13T13:14:47.732116+00:00 app[web.1]: ActionView::Template::Error (PG::UndefinedTable: ERROR: relation "categories" does not exist
2014-02-13T13:14:47.732116+00:00 app[web.1]: LINE 1: SELECT "categories".* FROM "categories" WHERE "categories"....
2014-02-13T13:14:47.732116+00:00 app[web.1]: : SELECT "categories".* FROM "categories" WHERE "categories"."parent_id" IS NULL ORDER BY "categories"."lft"):
2014-02-13T13:14:47.732116+00:00 app[web.1]: 3:
2014-02-13T13:14:47.732116+00:00 app[web.1]: 4: <%= render :partial => '/shared/search_form' %>
2014-02-13T13:14:47.732116+00:00 app[web.1]: 5:
2014-02-13T13:14:47.732271+00:00 app[web.1]: 6: <% Category.roots.each do |category| %>
2014-02-13T13:14:47.732116+00:00 app[web.1]: ^
2014-02-13T13:14:47.732116+00:00 app[web.1]: I, [2014-02-13T13:13:06.814571 #2] INFO -- : Completed 500 Internal Server Error in 9ms
2014-02-13T13:14:47.731683+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/request_id.rb:21:in `call'
2014-02-13T13:14:47.731828+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/methodoverride.rb:21:in `call'
2014-02-13T13:14:47.731683+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/rack/logger.rb:21:in `call'
2014-02-13T13:14:47.732271+00:00 app[web.1]: app/views/categories/index.html.erb:6:in `_app_views_categories_index_html_erb___3515298162048279666_69853047486040'
2014-02-13T13:14:47.732271+00:00 app[web.1]:
2014-02-13T13:14:47.732271+00:00 app[web.1]:
2014-02-13T13:14:47.732271+00:00 app[web.1]: I, [2014-02-13T13:14:42.123367 #2] INFO -- : Started GET "/" for 46.53.195.24 at 2014-02-13 13:14:42 +0000
2014-02-13T13:14:47.732271+00:00 app[web.1]: 8: <h3> <%= link_to category.name, products_path(:category => category.slug) %> </h3>
2014-02-13T13:14:47.732271+00:00 app[web.1]: 7: <div class="col-md-4">
2014-02-13T13:14:47.732429+00:00 app[web.1]: : SELECT "categories".* FROM "categories" WHERE "categories"."parent_id" IS NULL ORDER BY "categories"."lft"
2014-02-13T13:14:47.732429+00:00 app[web.1]: LINE 1: SELECT "categories".* FROM "categories" WHERE "categories"....
2014-02-13T13:14:47.732429+00:00 app[web.1]: ^
2014-02-13T13:14:47.732598+00:00 app[web.1]: 3:
2014-02-13T13:14:47.732598+00:00 app[web.1]: 4: <%= render :partial => '/shared/search_form' %>
2014-02-13T13:14:47.732598+00:00 app[web.1]: 5:
2014-02-13T13:14:47.732598+00:00 app[web.1]: 6: <% Category.roots.each do |category| %>
2014-02-13T13:14:47.732598+00:00 app[web.1]: 7: <div class="col-md-4">
2014-02-13T13:14:47.732598+00:00 app[web.1]: 8: <h3> <%= link_to category.name, products_path(:category => category.slug) %> </h3>
2014-02-13T13:14:47.732429+00:00 app[web.1]: I, [2014-02-13T13:14:42.134755 #2] INFO -- : Rendered categories/index.html.erb within layouts/application (9.8ms)
2014-02-13T13:14:47.732743+00:00 app[web.1]:
2014-02-13T13:14:47.732743+00:00 app[web.1]: I, [2014-02-13T13:14:47.723691 #2] INFO -- : Rendered shared/_search_form.html.erb (0.6ms)
2014-02-13T13:14:47.732743+00:00 app[web.1]: E, [2014-02-13T13:14:47.728029 #2] ERROR -- : PG::UndefinedTable: ERROR: relation "categories" does not exist
2014-02-13T13:14:47.732743+00:00 app[web.1]: LINE 1: SELECT "categories".* FROM "categories" WHERE "categories"....
2014-02-13T13:14:47.732598+00:00 app[web.1]: app/views/categories/index.html.erb:6:in `_app_views_categories_index_html_erb___3515298162048279666_69853047486040'
2014-02-13T13:14:47.732598+00:00 app[web.1]:
2014-02-13T13:14:47.732743+00:00 app[web.1]: I, [2014-02-13T13:14:47.729251 #2] INFO -- : Completed 500 Internal Server Error in 11ms
2014-02-13T13:14:47.732886+00:00 app[web.1]: F, [2014-02-13T13:14:47.731100 #2] FATAL -- :
2014-02-13T13:14:47.732886+00:00 app[web.1]: ActionView::Template::Error (PG::UndefinedTable: ERROR: relation "categories" does not exist
2014-02-13T13:14:47.732886+00:00 app[web.1]: LINE 1: SELECT "categories".* FROM "categories" WHERE "categories"....
2014-02-13T13:14:47.732886+00:00 app[web.1]: 3:
2014-02-13T13:14:47.732743+00:00 app[web.1]: ^
2014-02-13T13:14:47.732886+00:00 app[web.1]: 5:
2014-02-13T13:14:47.732886+00:00 app[web.1]: 6: <% Category.roots.each do |category| %>
2014-02-13T13:14:47.732886+00:00 app[web.1]: 7: <div class="col-md-4">
2014-02-13T13:14:47.731828+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/cache/strategy/local_cache.rb:83:in `call'
2014-02-13T13:14:47.733034+00:00 app[web.1]: 9:
2014-02-13T13:14:47.733034+00:00 app[web.1]: 8: <h3> <%= link_to category.name, products_path(:category => category.slug) %> </h3>
2014-02-13T13:14:47.731828+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/lock.rb:17:in `call'
2014-02-13T13:14:47.733034+00:00 app[web.1]:
2014-02-13T13:14:47.731828+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/runtime.rb:17:in `call'
2014-02-13T13:14:47.732886+00:00 app[web.1]: 4: <%= render :partial => '/shared/search_form' %>
2014-02-13T13:14:47.733034+00:00 app[web.1]: app/views/categories/index.html.erb:6:in `_app_views_categories_index_html_erb___3515298162048279666_69853047486040'
2014-02-13T13:14:47.733034+00:00 app[web.1]:
2014-02-13T13:14:47.731828+00:00 app[web.1]: vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
2014-02-13T13:14:47.731828+00:00 app[web.1]: vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'
2014-02-13T13:14:47.731972+00:00 app[web.1]:
2014-02-13T13:14:47.731972+00:00 app[web.1]:
2014-02-13T13:14:47.731972+00:00 app[web.1]: vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'
2014-02-13T13:14:47.732271+00:00 app[web.1]: I, [2014-02-13T13:14:42.124293 #2] INFO -- : Processing by CategoriesController#index as HTML
2014-02-13T13:14:47.732271+00:00 app[web.1]: I, [2014-02-13T13:14:42.127769 #2] INFO -- : Rendered shared/_search_form.html.erb (0.5ms)
2014-02-13T13:14:47.732271+00:00 app[web.1]: 9:
2014-02-13T13:14:47.732429+00:00 app[web.1]: I, [2014-02-13T13:14:42.134928 #2] INFO -- : Completed 500 Internal Server Error in 11ms
2014-02-13T13:14:47.732429+00:00 app[web.1]: F, [2014-02-13T13:14:42.136566 #2] FATAL -- :
2014-02-13T13:14:47.732429+00:00 app[web.1]: E, [2014-02-13T13:14:42.131964 #2] ERROR -- : PG::UndefinedTable: ERROR: relation "categories" does not exist
2014-02-13T13:14:47.732429+00:00 app[web.1]: LINE 1: SELECT "categories".* FROM "categories" WHERE "categories"....
2014-02-13T13:14:47.732429+00:00 app[web.1]: ^
2014-02-13T13:14:47.732429+00:00 app[web.1]: ActionView::Template::Error (PG::UndefinedTable: ERROR: relation "categories" does not exist
2014-02-13T13:14:47.732598+00:00 app[web.1]: 9:
2014-02-13T13:14:47.732743+00:00 app[web.1]: I, [2014-02-13T13:14:47.715526 #2] INFO -- : Started GET "/" for 46.53.195.24 at 2014-02-13 13:14:47 +0000
2014-02-13T13:14:47.732598+00:00 app[web.1]: : SELECT "categories".* FROM "categories" WHERE "categories"."parent_id" IS NULL ORDER BY "categories"."lft"):
2014-02-13T13:14:47.732743+00:00 app[web.1]: : SELECT "categories".* FROM "categories" WHERE "categories"."parent_id" IS NULL ORDER BY "categories"."lft"
2014-02-13T13:14:47.732743+00:00 app[web.1]: I, [2014-02-13T13:14:47.729098 #2] INFO -- : Rendered categories/index.html.erb within layouts/application (6.1ms)
2014-02-13T13:14:47.732743+00:00 app[web.1]: I, [2014-02-13T13:14:47.717991 #2] INFO -- : Processing by CategoriesController#index as HTML
2014-02-13T13:14:47.732886+00:00 app[web.1]: : SELECT "categories".* FROM "categories" WHERE "categories"."parent_id" IS NULL ORDER BY "categories"."lft"):
2014-02-13T13:14:47.732886+00:00 app[web.1]: ^
2014-02-13T13:14:42.190691+00:00 heroku[router]: at=info method=GET path=/ host=thawing-mesa-8086.herokuapp.com request_id=fa0aa0ee-7720-49c0-a2c4-271131bf6688 fwd="46.53.195.24" dyno=web.1 connect=0ms service=75ms status=500 bytes=1266

最佳答案

(PG::UndefinedTable:错误:关系“类别”不存在

您没有“类别”表

heroku run rake db:migrate

关于ruby-on-rails - Rails Heroku 应用程序错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21755977/

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