简体   繁体   中英

heroku ActionView::Template::Error (could not connect to server: No such file or directory

I am having trouble deploying my rails app to heroku. When I run the server locally with

bin/rails serve

everything works as intended. I am able to build and deploy on heroku, but when I visit the application I receive a "We're sorry, but something went wrong error."

When I run

heroku logs

I receive this error a few times

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"?

Is this asking about the /var/ru/postgresql/.s.PSGSQL.5432 on my local computer? I'm happy to supply any additional information if needed.

EDIT: Thanks, EvanG. I think you got me down the right track of looking outside of a postgresql issue. The problem seems to be either with the controller or the model.

I removed any reference to the class method in the index.html.erb. it renders properly. However, when I navigate to the /posts/new i receive

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'

Make sure you have Sass configured properly:

https://github.com/rails/sass-rails

This issue stems from you not having your stylesheet, etc in your app tree

Also while this doesn't seem like a postgres issue if you're getting this far into the build. Make sure that is correctly setup too: https://devcenter.heroku.com/articles/getting-started-with-rails5

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM