Can not connect to MS SQL Server using django-mssql-backend

Dear all,

I have a problem when trying to connect to MS SQL Server (I’m using SQL Server 2019 Express). I’ve installed the django-mssql-backend package and configured in the settings.py as the instruction like that:
DATABASE = {
‘default’: {
‘ENGINE’: ‘sql_server.pyodbc’,
‘NAME’: ‘crm_data’,
‘HOST’: ‘CN-76\SQLEX2019’,
‘PORT’: ‘’,
‘OPTIONS’: {
‘driver’: ‘SQL Server Native Client 11.0’
}
}
}

But, when do the migration, it raised an error:
raise ImproperlyConfigured("settings.DATABASES is improperly configured. "
django.core.exceptions.ImproperlyConfigured: settings.DATABASES is improperly configured. Please supply the ENGINE value. Check settings documentation for more details.

Please help me to solve this. Thanks a lot.

The name of the settings variable is “DATABASES” not “DATABASE”.

(Also, when you’re posing code, enclose the code between two lines consisting only of 3 backtick (`) characters to preserve formatting.)

Ken

1 Like