[Django]-Postgresql django not sending password

3👍

I suspect you’re not passing the password correctly. Here’s how you debug. After the DATABASES line in settings.py, can you try printing out the dict.

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': 'dbname',
        'USER': 'dbuser',
        'PASSWORD': PROD_DB_PASSWORD,
        'HOST': 'localhost',
        'PORT': '5432',
        }
    }
print DATABASES

Then manage.py runserver as you would.

See if the password is properly passed. Apologies my rep’s not enough to comment yet.

👤munsu

2👍

For future readers also check the spelling and later cases. All database keys must be in UPPER CASE e.g ENGINE, NAME, USER, PASSWORD, HOST and PORT.

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': os.getenv("DB_NAME", "db_name"),
        "USER": os.getenv("DB_USERNAME", "db_user"),
        "PASSWORD": os.getenv("DB_PASSWORD", "db@password"),
        "HOST": os.getenv("DB_HOST", "localhost"),
        "PORT": os.getenv("DB_PORT", "5432")
    }
}

Leave a comment