Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

281
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!