WebFaction
Community site: login faq

I'm trying to run a django migration to update my database, but "manage.py migrate" can't connect to my postgresql db. The odd thing is: my django website (which is exactly the same code) is working including connecting to the db.

The error I was getting:

  File "zzzzzz/site-packages/psycopg2/__init__.py", line 164, in connect
    conn = _connect(dsn, connection_factory=connection_factory, async=async)
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/run/postgresql/.s.PGSQL.xxxxxx"?


also:

django.db.utils.OperationalError: could not connect to server: No such file or directory 
        Is the server running locally and accepting 
        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL

asked 02 Aug, 16:24

twtwt's gravatar image

twtwt
1815
accept rate: 20%

edited 02 Aug, 16:42


Workaround: Change HOST variable to either localhost or 127.0.0.1 .

See https://docs.djangoproject.com/en/1.11/ref/settings/#host

Then manage.py worked

permanent link

answered 02 Aug, 16:26

twtwt's gravatar image

twtwt
1815
accept rate: 20%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×888
×105
×9

question asked: 02 Aug, 16:24

question was seen: 210 times

last updated: 02 Aug, 16:42

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2016 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM