Home > front end >  Authentication failed django
Authentication failed django

Time:12-06

I get an error password authentication failed for user "usertodoproject". Really losing my patience, so far I have done couple of new databases and used fpr example this ALTER USER todouser WITH PASSWORD 'todo'; it did not help either. Any ideas?

*EDIT IT IS DOCKER-COMPOSE FAULT NOT SETTINGS. App runs without docker.

settings.py

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': 'todoproject',
        'USER': 'usertodoproject',
        'PASSWORD': 'todoprojectpass',
        'HOST': 'db',
        'PORT': '5432',
    }
}

docker-compose

version: "3"

services:
  web:
    build: .
    command: python manage.py runserver 0.0.0.0:8000
    ports: 
      - 8000:8000
    volumes:
      - .:/code
    depends_on:
      - db
    restart: always
  db:
    image: postgres
    environment:
    - POSTGRES_DB=todoproject
    - POSTGRES_USER=usertodoproject
    - POSTGRES_PASSWORD=todoprojectpass
    ports:
    - 5432:5432

CodePudding user response:

You should verify few point that outscope the python programming:

  • Status of postgresql, is it running with systemctl status postgresql command
  • verify the listening port 5432 with netstat -plantu command (db is the host ?)
  • is user usertodoproject is created ?
  • Related