skip to Main Content

When I`m trying to connect Django Server to PostgreSQL db there is an error:
" port 5433 failed: Connection refused Is the server running on that host and accepting TCP/IP connections? "

I`m using Windows 10, Pycharm, Debian

Settings in Django:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql',
        'NAME': 'ps_store_db',
        'USER': 'zesshi',
        'PASSWORD': '',
        'HOST': 'localhost',
        'PORT': '5433',
    }
}

Tried to check connection with DBeaver and all`s good there, but still cant connect with Django

My firewall is off, i was trying to change from 5432 to 5433

Dbeaver connection

Dbeaver connection 2

2

Answers


  1. Try restarting/reinstalling postgres. Most likely DBeaver has blocked the port that’s why you are not able to connect from django.
    (Sorry for posting answer, i am unable to comment yet)

    Login or Signup to reply.
  2. The default port of the PG database is 5432. If you need to change this port, you need to edit the postgresql.conf file and restart the database service before the client can access it.
    You also need to check the pg_hba.conf file. The recommended configuration is as follows:

    host all all 0.0.0.0/0 md5
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search