Home > front end >  Django - settings.DATABASES is improperly configured. Please supply the ENGINE value
Django - settings.DATABASES is improperly configured. Please supply the ENGINE value

Time:01-08

I've got a postgres DB which Django successfully connects to but when trying to create a new model I'm getting the error settings.DATABASES is improperly configured. Please supply the ENGINE value. Check settings documentation for more details.

I know settings.DATABASES is correctly configured as I've already created models which then Django used to create tables in the DB but for whatever reason it is now causing this error. You can also see that I have already "supplied the ENGINE value".

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': os.environ['POSTGRES_DB'],
        'USER': os.environ['POSTGRES_USER'],
        'PASSWORD': os.environ['POSTGRES_PASSWORD'],
        'HOST': 'db',
        'POST': '5432',
    }
}

All help is appreciated.

CodePudding user response:

Replace your ENGINE setting by:

'ENGINE': 'django.db.backends.postgresql'

It is the correct setting in Django 3 and up. See https://docs.djangoproject.com/en/3.0/internals/deprecation/#deprecation-removed-in-3-0.

CodePudding user response:

Turns out I'm an idiot.

I'm using docker and I forgot that I need to enter the container to do DB migrations

  •  Tags:  
  • Related