Cannot connect ElephantSQL database to django

I am trying to connect elephant sql service to django. I configured db settings in settings.py.

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql',
        'NAME': 'test_db1',
        'USER': 'xxxxx',
        'PASSWORD': 'xxxxxxxxxxxxxxxxxxxx',
        'HOST': 'arjuna.db.elephantsql.com',
        'PORT': ''
    }
}

But It gives an error when I make migrations.

error.png

I tried adding port number 5432, but still it doesn't work. Can someone help me to fix this error?

I currently run my connection as follows,

DATABASES = {

     'default': {

         'ENGINE': 'django.db.backends.postgresql_psycopg2',

         'NAME': 'test_db1',

         'USER': 'test_db1',

         'PASSWORD': '************************',

         'HOST': 'arjuna.db.elephantsql.com',

         'PORT': '5432',

     }
 }

Notice im using psycopg2. Name and User are the same.

The error is showing this host, "heffalump.db.elephantsql.com" Did you change the Database at some point? If you did, this might be the problem, and you probably need to do some work with the migrations.

Back to Top