Since upgrading OSX to version 10.7.3, when I attempt to run a Django "syncdb" command, I receive the following psycopg2 error from Postgresql 8.4.2:
psycopg2.OperationalError: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?
I'm able to open psql without incident, but when I attempt to run "pg_ctl status", I receive this error as well:
pg_ctl: could not open PID file "/Library/PostgreSQL/8.4/data/postmaster.pid": Permission denied
Is there a correlation?
I had the same problem too: updated osx to 10.7.3 and after I restarted the postgres server I got the same issue when I tried to run $ ./manage.py dbshell
that goes through psycopg2, but didn't have problem connecting to postgres using psql.
To me the problem appears to be related just to "connections on Unix domain socket", because psycopg2 uses the newly 10.7.3 osx updated postgres library.
I tried to reinstall psycopg2, but nothing was changed.
So, I changed the HOST value on the databases section of my django settings.py, and instead of having an empty string I put 'localhost'
.
and it works perfectly!
Eelke 's problem was the same as mine. The quickest fix for this would be to add
export PGHOST=/tmp
an environment variable in your .bashrc/.zshrc/etc file (depending on which you use).
The best fix would be to set the specific path in your apps config file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With