0

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.

1
  • The error message seems pretty clear. Did you attempt to create a database with that name? Commented Nov 4, 2022 at 14:39

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

I thought it would be automatically created. (Beginners doubt)
0

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

1 Comment

yes the IP is correct

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.