database setting
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". and router.py one more thing first database customer I did not get any error during makemigration command and successfully created table in database
DATABASES ={
'default': {},
'users':{
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'customer',
'USER': 'postgres',
'PASSWORD': '123',
},
'listings':{
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'listing',
'USER': 'postgres',
'PASSWORD': '123',
},
}
DATABASE_ROUTERS = ['customer.router.AuthRouter', 'list.router.ListingRouter']
router.py
class ListingRouter:
route_app_labels = {'listing'}
def db_for_read(self, model, **hints):
if model._meta.app_label in self.route_app_labels:
return 'listings'
return None
def db_for_write(self, model, **hints):
if model._meta.app_label in self.route_app_labels:
return 'listings'
return None
def allow_relation(self, obj1, obj2, **hints):
if (obj1._meta.app_label in self.route_app_labels or
obj2._meta.app_label in self.route_app_labels
):
return True
return None
def allow_migrate(self, db, app_label, model_name=None, **hints):
if app_label in self.route_app_labels:
return db == 'listings'
return None
database setting and router.py attached 1 2