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

557
Views
Django psycopg2.OperationalError: fe_sendauth error but not connecting to postgresql database

I am using the following sqlite connection in my myapp/settings.py file:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': ':testdb:',
        #I also tried 'NAME': 'testdb',
    },
}

in my manage.py file I am using:

if __name__ == "__main__":
    os.environ.setdefault("myapp.settings")
    from django.core.management import execute_from_command_line
    execute_from_command_line(sys.argv)

On running ./manage.py migrate on the command line I get the following error:

django.db.utils.OperationalError: fe_sendauth: no password supplied

I tried removing psycopg2 and re-ran the migration and get the following error:

django.core.exceptions.ImproperlyConfigured: Error loading psycopg2 module: No module named 'psycopg2'

I can't work out why django is trying to connect to a psql database where the only DATABSES configuration in the application is for sqlite3.

Could this be due to a dependency?

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Try this,

import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
    }
}

This might be helpful for you.

over 4 years ago · Santiago Trujillo Report

0

Django only uses DATABASES setting to generate migrations using a specific database driver. I believe somewhere, there is an import which is overriding your DATABASES setting. These are possible places to look for debugging in order of priority.

  1. Any import into settings.py file after you set DATABASES variable which might override it.
  2. if above is not the case, Some dependency must be overriding this setting manually. you might want to look into your INSTALLED_APPS.
  3. If still not enough, you might need to look at any other dependency that you are using in your project which tries to interact with django.
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!