Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

284
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda