Heroku Ruby On Rails服务器日志显示“用户"不存在 [英] Heroku Ruby On Rails Server Logs says 'Users' does not Exist

查看:134
本文介绍了Heroku Ruby On Rails服务器日志显示“用户"不存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在关注 Ruby On Rails图书教程,第2章,toy_app

存储库位于BitBucket上, https://bitbucket.org/Marium36/toy_app/

到目前为止,我可以在本地服务器上打开该应用程序,即

localhost:3000 

localhost:3000/users

heroku出现了问题.

Heroku应用只能打开

https://salty-wave-17330.herokuapp.com/

我尝试

https://salty-wave-17330.herokuapp.com/users

我收到错误消息

很抱歉,出了点问题.如果您是应用程序 所有者检查日志以获取更多信息.

服务器日志, https://bitbucket.org/Marium36/toy_app/src/master/heroku_server_logs

显示的持续错误消息是Users不存在---但确实存在,我可以在本地计算机中加载localhost:3000/users

请帮助!!!

2019-06-29T11:24:46.008853+00:00 app[web.1]: I, [2019-06-29T11:24:46.008752 #4]  INFO -- : [5d839ee1-e92f-46d7-81d0-9fd508157239] Started GET "/users" for PRIVATE_IP at 2019-06-29 11:24:46 +0000
2019-06-29T11:24:46.010267+00:00 app[web.1]: I, [2019-06-29T11:24:46.010188 #4]  INFO -- : [5d839ee1-e92f-46d7-81d0-9fd508157239] Processing by UsersController#index as HTML
2019-06-29T11:24:46.013170+00:00 app[web.1]: I, [2019-06-29T11:24:46.013098 #4]  INFO -- : [5d839ee1-e92f-46d7-81d0-9fd508157239]   Rendering users/index.html.erb within layouts/application
2019-06-29T11:24:46.055431+00:00 app[web.1]: D, [2019-06-29T11:24:46.055315 #4] DEBUG -- : [5d839ee1-e92f-46d7-81d0-9fd508157239]   User Load (1.5ms)  SELECT "users".* FROM "users"
2019-06-29T11:24:46.056103+00:00 app[web.1]: I, [2019-06-29T11:24:46.056041 #4]  INFO -- : [5d839ee1-e92f-46d7-81d0-9fd508157239]   Rendered users/index.html.erb within layouts/application (42.8ms)
2019-06-29T11:24:46.056339+00:00 app[web.1]: I, [2019-06-29T11:24:46.056280 #4]  INFO -- : [5d839ee1-e92f-46d7-81d0-9fd508157239] Completed 500 Internal Server Error in 46ms (ActiveRecord: 13.4ms)
2019-06-29T11:24:46.057108+00:00 app[web.1]: F, [2019-06-29T11:24:46.057045 #4] FATAL -- : [5d839ee1-e92f-46d7-81d0-9fd508157239]
2019-06-29T11:24:46.063287+00:00 app[web.1]: F, [2019-06-29T11:24:46.057141 #4] FATAL -- : [5d839ee1-e92f-46d7-81d0-9fd508157239] ActionView::Template::Error (PG::UndefinedTable: ERROR:  relation "users" does not exist

解决方案

PG::UndefinedTable: ERROR表示您尚未创建表.您需要运行heroku run rake db:migrate,以便将表添加到您的Heroku Postgres.

I am following Ruby On Rails Book Tutorial, Chapter 2, toy_app

Repository is on BitBucket, https://bitbucket.org/Marium36/toy_app/

So far, I can open the app on my local server, i.e

localhost:3000 

and

localhost:3000/users

Problem arises with heroku.

Heroku app can only open

https://salty-wave-17330.herokuapp.com/

As soon as I attempt

https://salty-wave-17330.herokuapp.com/users

I get error,

We're sorry, but something went wrong. If you are the application owner check the logs for more information.

Server logs, https://bitbucket.org/Marium36/toy_app/src/master/heroku_server_logs

The continual error message that shows is that Users does not exist --- but it does, I can load in my local machine, i.e. localhost:3000/users

Please help!!!

2019-06-29T11:24:46.008853+00:00 app[web.1]: I, [2019-06-29T11:24:46.008752 #4]  INFO -- : [5d839ee1-e92f-46d7-81d0-9fd508157239] Started GET "/users" for PRIVATE_IP at 2019-06-29 11:24:46 +0000
2019-06-29T11:24:46.010267+00:00 app[web.1]: I, [2019-06-29T11:24:46.010188 #4]  INFO -- : [5d839ee1-e92f-46d7-81d0-9fd508157239] Processing by UsersController#index as HTML
2019-06-29T11:24:46.013170+00:00 app[web.1]: I, [2019-06-29T11:24:46.013098 #4]  INFO -- : [5d839ee1-e92f-46d7-81d0-9fd508157239]   Rendering users/index.html.erb within layouts/application
2019-06-29T11:24:46.055431+00:00 app[web.1]: D, [2019-06-29T11:24:46.055315 #4] DEBUG -- : [5d839ee1-e92f-46d7-81d0-9fd508157239]   User Load (1.5ms)  SELECT "users".* FROM "users"
2019-06-29T11:24:46.056103+00:00 app[web.1]: I, [2019-06-29T11:24:46.056041 #4]  INFO -- : [5d839ee1-e92f-46d7-81d0-9fd508157239]   Rendered users/index.html.erb within layouts/application (42.8ms)
2019-06-29T11:24:46.056339+00:00 app[web.1]: I, [2019-06-29T11:24:46.056280 #4]  INFO -- : [5d839ee1-e92f-46d7-81d0-9fd508157239] Completed 500 Internal Server Error in 46ms (ActiveRecord: 13.4ms)
2019-06-29T11:24:46.057108+00:00 app[web.1]: F, [2019-06-29T11:24:46.057045 #4] FATAL -- : [5d839ee1-e92f-46d7-81d0-9fd508157239]
2019-06-29T11:24:46.063287+00:00 app[web.1]: F, [2019-06-29T11:24:46.057141 #4] FATAL -- : [5d839ee1-e92f-46d7-81d0-9fd508157239] ActionView::Template::Error (PG::UndefinedTable: ERROR:  relation "users" does not exist

解决方案

PG::UndefinedTable: ERROR means you haven't created the table. You need to run heroku run rake db:migrate so that the tables are added to your Heroku Postgres.

这篇关于Heroku Ruby On Rails服务器日志显示“用户"不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆