Is the server running on host "192.168.234. To establish a connection with the Postgres database via python, we will utilize one of the most frequently used adapters named psycopg2. Psycopg2.OperationalError: could not connect to server: Connection timed out (0x0000274C/10060) The code, I run, looks like so: > connection = nnect(user = "postgres",įile "C:\Python34\lib\site-packages\psycopg2-2.6.1-p圓.4-win-amd64.egg \psycopg2\_init_.py", line 164, in connectĬonn = _connect(dsn, connection_factory=connection_factory, async=async) What is wrong with that and how can I fix it? I guess, simply changing nf and restarting Postgres is not enough. So it seems like Python (I tried psycopg2 and sqlalchemy) for some reason is bound by this 5432 port number and does not accept other port numbers. The connect() function creates a new database session and returns a new instance of the connection class. To connect to the suppliers database, you use the connect() function of the psycopg2 module. If I switch back to port 5432 - fix nf and restart Postgres - then my Python script starts working. CREATE DATABASE suppliers Connect to the PostgreSQL database using the psycopg2. When, however, I try to connect to it using Python, I get an error message Is the server running on host "192.168.234.137" and accepting If I use for example Navicat, then I can easily establish connection, so Postgres running at port 5433 is reachable. I try to connect to Postgres from another machine. What I should to do It crashes on commands python manage.py collectstatic -noinput & python manage.py makemigrations blog & python manage.py migrate. The machine on my local network has this IP address 192.168.234.137. My django project cannot connect to postgres database container. Its pg_hba.conf contains this string: host all all 0.0.0.0/0 md5Īnd nf contains these lines: listen_addresses = '*' I have Postgres up and running on one of my machines.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |