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

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

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 Relatório

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 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