Host all all 127.0.0.1/32 md5 # IPv6 local connections: # "local" is for Unix domain socket connections only My pg_hba.conf file has the following: # TYPE DATABASE USER ADDRESS METHOD I would much appreciate any insight as to why I can't connect my Python code to Postgres! >nnect("dbname=postgres user=postgres host=localhost password=postgres port=5432")Īnd I get the same error. I have tried testing the connection string in the Python3 shell as well: >import psycopg2 I am confused as to why the authentication is failing for a valid user/password combo! Peewee.OperationalError: FATAL: password authentication failed for user "postgres" Reraise(new_type, new_type(exc_value, *exc_args), traceback)įile "/home/allison_johnson/.local/share/virtualenvs/lib-jEOreobP/lib/python3.6/site-packages/peewee.py", line 183, in reraise Self._initialize_connection(self._nn)įile "/home/allison_johnson/.local/share/virtualenvs/lib-jEOreobP/lib/python3.6/site-packages/peewee.py", line 2873, in _exit_ **psycopg2.OperationalError: FATAL: password authentication failed for user "postgres"**ĭuring handling of the above exception, another exception occurred:įile "/home/allison_johnson/.local/share/virtualenvs/lib-jEOreobP/lib/python3.6/site-packages/peewee.py", line 3038, in connect Self._t_connection(self._connect())įile "/home/allison_johnson/.local/share/virtualenvs/lib-jEOreobP/lib/python3.6/site-packages/peewee.py", line 3730, in _connectĬonn = nnect(database=self.database, **nnect_params)įile "/home/allison_johnson/.local/share/virtualenvs/lib-jEOreobP/lib/python3.6/site-packages/psycopg2/_init_.py", line 127, in connectĬonn = _connect(dsn, connection_factory=connection_factory, **kwasync) When I launch my Python virtual environment using pipenv shell and then run python3 main.py I get the following error: // ♥ python3 main.pyįile "/home/allison_johnson/.local/share/virtualenvs/lib-jEOreobP/lib/python3.6/site-packages/peewee.py", line 3035, in connect Those are the credentials I use to start up a Postgres server once I have changed into the postgres user on my machine using su - postgres. I am certain that I have a Postgres user named 'postgres' with a password of 'postgres'. In my Python code I store all of the info I'll need to access a Postgres database, and then attempt to connect to the database as follows: #lib/main.pyĭb = PostgresqlDatabase('people', user='postgres', password='postgres', host='localhost', port=5432) I am trying to set up psycopg2/peewee on WSL (Windows machine). I am new to web development in Python and would really appreciate some help.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |