Reputation: 555
I was setting Django up to use PostgresQL and for some reason, it won't connect it keep giving me this error:
Try using 'django.db.backends.XXX', where XXX is one of: 'mysql', 'oracle', 'sqlite3'
here's the code for it in setting.py:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'DBNAME',
'USER': 'postgres',
'PASSWORD': 'DBPW',
'HOST': 'localhost'
}
}
I had the exact same code in a different project and it works perfectly fine!
Upvotes: 0
Views: 6713
Reputation: 368
use this config instead of your config:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'DBNAME',
'USER': 'postgres',
'PASSWORD': 'DBPW',
'HOST': 'localhost',
'PORT': '',
}
}
your ENGINE
is not correct.
Upvotes: 0
Reputation: 1644
you need to pip install psycopg2
, looks like the Postgres adaptor is not installed
Upvotes: 1