When setting use multiple databases getting error settings.DATABASES is improperly configured

I am trying to setup multiple databases in django and I am getting error message when trying to submit information using website form. The web form still submits data but shows error message. Also I am able to access the django admin page successfully.

error: ImproperlyConfigured at /signup settings.DATABASES is improperly configured. Please supply the ENGINE value. Check settings documentation for more details.

Here is the code of my settings.DATABASES

DATABASES = {
    'default': {},
    'users_db':{        
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': BASE_DIR / 'users.db.sqlite3',
    }
}

here is DATABASE_ROUTERS=['routers.db_routers.AuthRouter',]

below is code for Auth Router:

class AuthRouter:
    router_app_labels={'auth','user','contenttypes','sessions','admin' }

    def db_for_read(self, model, **hints):
        if model._meta.app_label in self.router_app_labels:
            return 'users_db'
        return None

    def db_for_write(self, model, **hints):
        if model._meta.app_label in self.router_app_labels:
            return 'users_db'
        return None

    def allow_relation(self, obj1, obj2, **hints):
        if(
            obj1._meta.app_label in self.router_app_labels or
            obj2._meta.app_label in self.router_app_labels
        ):
            return True
        return None
    
    def allow_migrate(self, db, app_label, model_name=None, **hints):
        if app_label in self.router_app_labels:
            return db == 'users_db'
        return None

Would like to see the reason for this error and resolution. I have already done data migration for users_db

A simple successfull example of implementation of github code would also help if solutions don't work.

Back to Top