Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

282
Vistas
Django takes ubuntu username to connect database instead of db user from settings.py

I trying to run django website on aws ec2 machine (ubuntu). my postgresql database running on aws RDS

when I run $python manage.py runserver, it throws this error:

django.db.utils.OperationalError: connection to server at "xxxxx.xxxxx.us-east-2.rds.amazonaws.com" (xxx.xx.xx.xxx), port 5432 failed: FATAL:  password authentication failed for user "ubuntu"

basically django trying to connect database using ubuntu user instead of postgres user in settings.py

my settings.py:

DATABASES = {
'default': {
    'ENGINE': 'django.db.backends.postgresql',
    'NAME': config('NAME'),
    'USER': config('USER'),
    'PASSWORD':config('PASSWORD'),
    'HOST':config('HOST')
    #'HOST':'localhost'
}

}

.env file:

SECRET_KEY=xxxx
DEBUG=True
HOST=xxx.xxx.us-east-2.rds.amazonaws.com
NAME=xxxx
USER=postgres
PASSWORD=xxxxxx

my password has special special char '#'

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

A Linux distribution normally uses the $USER variable to specify the username, not the database.

I would advise using $DB_USER or something similar, so:

 DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql', 'NAME': config(' DB_NAME '), 'USER': config(' DB_USER '), 'PASSWORD':config(' DB_PASSWORD '), 'HOST':config(' DB_HOST ') } }

and then configure with:

 SECRET_KEY=xxxx DEBUG=True DB_HOST =xxx.xxx.us-east-2.rds.amazonaws.com DB_NAME =xxxx DB_USER =postgres DB_PASSWORD =xxxxxx
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda