1

I am getting an error trying to visit my Django app. I am running Gentoo and the web server is Apache with the mod_wsgi module to display Django. The error says

OperationalError at /admin/
could not connect to server: Permission denied
Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

I know Django can connect to the Postgres database since I can run python manage.py syncdb successfully. I can also enter the interactive terminal with psql -U root -d mysite.

The ls -la of the socket is

root@ip-99-99-99-99 /var/run/postgresql # ls -la
total 12K
drwxr-x--- 2 postgres 4.0K Mar  7 18:39 ./
drwxr-xr-x 6 root     4.0K Mar  7 22:58 ../
srwxrwxrwx 1 postgres    0 Mar  7 23:31 .s.PGSQL.5432
-rw------- 1 postgres   71 Mar  7 23:31 .s.PGSQL.5432.lock

1 Answer 1

4

Curious... as a quick test, try running chmod o+rx /var/run/postgresql -- if that fixes the problem (as I suspect it will) then you'll need to diagnose why the permissions are screwed up on the directory. On my system (Debian Squeeze) the perms are 2775 postgres:postgres; while it isn't necessary to have that particular mode, you'll want (at least) o+x to allow other users to traverse the directory to get to the socket.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .