Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • 1
    Question specifies PEER authentication. Commented Jan 24, 2018 at 20:51
  • 1
    This is not the correct answer for the user "postgres" but explicitly adding "localhost" (rather than an empty string) as the host in django's settings.py made the difference for me. Commented Nov 13, 2018 at 13:06
  • 1
    For me it also made the difference just to add host='localhost', now it's working. The other answer saying "run your python script with sudo -u postgres" is not my preferred solution because I want this authentification to happen within the python script, or even be able to run it interactively in a jupyter notebook or iPython. Commented Feb 1, 2021 at 18:43