【发布时间】:2018-06-11 17:58:51
【问题描述】:
我在将我的 rails 应用程序部署到 heroku 时遇到问题。当我在本地运行服务器时
bin/rails serve
一切都按预期进行。我能够在 heroku 上构建和部署,但是当我访问应用程序时,我收到“我们很抱歉,但出了点问题”。
当我跑步时
heroku logs
我多次收到此错误
2018-06-11T15:14:29.322271+00:00 app[web.1]: F, [2018-06-11T15:14:29.322180 #4] FATAL -- : [edd09d28-da55-4c86-8fc9-372cd15b48dc] ActionView::Template::Error (could not connect to server: No such file or directory
2018-06-11T15:14:29.322274+00:00 app[web.1]: Is the server running locally and accepting
2018-06-11T15:14:29.322276+00:00 app[web.1]: connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
这是在询问我本地计算机上的 /var/ru/postgresql/.s.PSGSQL.5432 吗?如果需要,我很乐意提供任何其他信息。
编辑:谢谢,EvanG。我认为你让我在寻找 postgresql 问题之外的正确轨道。问题似乎出在控制器或模型上。
我删除了对 index.html.erb 中类方法的任何引用。它正确呈现。但是,当我导航到我收到的 /posts/new 时
2018-06-11T21:00:45.897171+00:00 heroku[router]: at=info method=GET path="/posts/new" host=testapp.herokuapp.com request_id=63d5860f-7f9e-4bc7-9481-6883a57260eb fwd="68.52.147.0" dyno=web.1 connect=0ms service=5ms status=500 bytes=1827 protocol=https
2018-06-11T21:00:45.892864+00:00 app[web.1]: I, [2018-06-11T21:00:45.892730 #4] INFO -- : [63d5860f-7f9e-4bc7-9481-6883a57260eb] Started GET "/posts/new" for 68.52.147.0 at 2018-06-11 21:00:45 +0000
2018-06-11T21:00:45.893850+00:00 app[web.1]: I, [2018-06-11T21:00:45.893765 #4] INFO -- : [63d5860f-7f9e-4bc7-9481-6883a57260eb] Processing by PostsController#new as HTML
2018-06-11T21:00:45.895690+00:00 app[web.1]: I, [2018-06-11T21:00:45.895624 #4] INFO -- : [63d5860f-7f9e-4bc7-9481-6883a57260eb] Completed 500 Internal Server Error in 2ms
2018-06-11T21:00:45.896223+00:00 app[web.1]: F, [2018-06-11T21:00:45.896140 #4] FATAL -- : [63d5860f-7f9e-4bc7-9481-6883a57260eb]
2018-06-11T21:00:45.896283+00:00 app[web.1]: F, [2018-06-11T21:00:45.896222 #4] FATAL -- : [63d5860f-7f9e-4bc7-9481-6883a57260eb] PG::ConnectionBad (could not connect to server: No such file or directory
2018-06-11T21:00:45.896286+00:00 app[web.1]: Is the server running locally and accepting
2018-06-11T21:00:45.896288+00:00 app[web.1]: connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
2018-06-11T21:00:45.896290+00:00 app[web.1]: ):
2018-06-11T21:00:45.896345+00:00 app[web.1]: F, [2018-06-11T21:00:45.896280 #4] FATAL -- : [63d5860f-7f9e-4bc7-9481-6883a57260eb]
2018-06-11T21:00:45.896377+00:00 app[web.1]: F, [2018-06-11T21:00:45.896331 #4] FATAL -- : [63d5860f-7f9e-4bc7-9481-6883a57260eb] app/controllers/posts_controller.rb:18:in `new'
【问题讨论】:
-
你在heroku上设置postgresql了吗?
标签: ruby-on-rails postgresql heroku