skip to Main Content

I am trying to connect my django app to postgres but it gives the following error.

connection to server at "127.0.0.1", port 5432 failed: FATAL:  database "testDB" does not exist

the postgres server is running I have checked it also restarted the server still I get the same error

my database settings.

  DATABASES = {
      'default': {
          'ENGINE': 'django.db.backends.postgresql',
          'NAME': 'testDB',
          'USER': 'postgres',
          'PASSWORD': 'xxxxx',
          'HOST': '127.0.0.1',
          'PORT': '5432',
      }
  }

I tried to check if the server is running and it is running, also restarted the server but still the same error.

2

Answers


  1. did your Postgres DB hosted in the correct IP? , Check the info there is a mistake surely

    Login or Signup to reply.
  2. database "testDB" does not exist

    If you want to connect to database "testDB", it should exist.
    But it isn’t.

    Try to create db with name "testDB" by command like, like this,

    create database 'testDB';
    

    or in pgadmin.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search