I just started a new rails app using
rails new myapp --database=postgresql
Then I generate some static pages:
rails g controller StaticPages home about
When I started the server and visit localhost:3000/static_pages/home, the PG::Error shows up:
PG::Error
could not connect to server: Connection refused (0x0000274D/10061)
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Connection refused (0x0000274D/10061)
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?
I didn’t change anything else
Any idea how to make postgresql work?
It looks like your postgres server is not running. Have you started it up? If you check your system processes do you see the postgres daemon running?
If you are trying to use rails + postgres, I would recommend checking out this great video by Pete Cooper.