• My Errors
  • Login
  • Search
Search again

Error #69806

OperationalError: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?


Appears when starting a Django site.

User's solution

This works!
+0 Vote Up

Install a Postgres database

$ cd /Library/PostgreSQL8
$ sudo -u postgres ./bin/postgres -Ddata
$ sudo -u postgres ./createdb --owner=sample sample
$ sudo -u postgres ./psql -U sample sample

Start it

$ sudo -u postgres ./bin/postgres -Ddata
Password:
LOG: database system was shut down at 2008-01-04 20:53:47 CET
LOG: checkpoint record is at 0/4B7098
LOG: redo record is at 0/4B7098; undo record is at 0/0; shutdown TRUE
LOG: next transaction ID: 0/713; next OID: 16577
LOG: next MultiXactId: 1; next MultiXactOffset: 0
LOG: database system is ready

Try getting shell access to Postgres

$ sudo -u postgres ./bin/psql -U sample sample
Welcome to psql 8.2.5, the PostgreSQL interactive terminal.

Type: \copyright for distribution terms
\h for help with SQL commands
\? for help with psql commands
\g or terminate with semicolon to execute query
\q to quit
myapp=>

Start Django

$ ./manage.py runserver 8001
Validating models...
0 errors found

Django version 0.97-pre-SVN-6993, using settings 'myapp.settings'
Development server is running at http://127.0.0.1:8001/
Quit the server with CONTROL-C.

Apr 12, 2008