django/postgresql setup - psycopq2.OperationalError

1.4k views Asked by At

I'm getting a 'psycopq2.OperationalError' when executing: python manage.py syncdb. The postgresql server seems to be up and running when tested with a djangostack script. Anyone run across this? Just going through the django tutorial and setting things up. Complete newbie to the framework... I've found a bunch of similar problems on this forum, but none seems like an exact match... Thanks!

Traceback (most recent call last):
  File "manage.py", line 11, in <module>
    execute_manager(settings)
  File "/Applications/djangostack-1.2.5-0/apps/django/lib/python2.6/site-packages/django/core/management/__init__.py", line 438, in execute_manager
    utility.execute()
  File "/Applications/djangostack-1.2.5-0/apps/django/lib/python2.6/site-packages/django/core/management/__init__.py", line 379, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Applications/djangostack-1.2.5-0/apps/django/lib/python2.6/site-packages/django/core/management/base.py", line 191, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/Applications/djangostack-1.2.5-0/apps/django/lib/python2.6/site-packages/django/core/management/base.py", line 220, in execute
    output = self.handle(*args, **options)
  File "/Applications/djangostack-1.2.5-0/apps/django/lib/python2.6/site-packages/django/core/management/base.py", line 351, in handle
    return self.handle_noargs(**options)
  File "/Applications/djangostack-1.2.5-0/apps/django/lib/python2.6/site-packages/django/core/management/commands/syncdb.py", line 56, in handle_noargs
    cursor = connection.cursor()
  File "/Applications/djangostack-1.2.5-0/apps/django/lib/python2.6/site-packages/django/db/backends/__init__.py", line 75, in cursor
    cursor = self._cursor()
  File "/Applications/djangostack-1.2.5-0/apps/django/lib/python2.6/site-packages/django/db/backends/postgresql_psycopg2/base.py", line 136, in _cursor
    self.connection = Database.connect(**conn_params)
psycopg2.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"?
1

There are 1 answers

0
Chris Travers On

To summarize the comments in an answer, the basic problem is that Bitami requires settings to be set in other files.

  1. The port must be set in djangostack-1.2.5-0/postgresql/scripts/ctl.sh

  2. Some other settings, including the username of postgres, get set in the settings.py so this may need to be changed as well.