Home > front end >  cannot connect Django to postgres
cannot connect Django to postgres

Time:11-05

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.

CodePudding user response:

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.

CodePudding user response:

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

  • Related