I\'m trying to connect my Django app to SQL Server 2016. I\'ve tried using django-pyodbc but it doesn\'t support Django 1.11. Instead I installed django-mssql 1.8. When I try to
Following official django documentation (currently django 3.1) django-mssql-backend should be used. Django-MSSQL-backend django database adapter is a fork of django-pyodbc-azure which:
Other solutions django-pyodbc-azure, django-sqlserver and django-mssql as of 2020-11 look to be obsolete.
You can use django-pyodbc-azure because it has support up to current versions of django 2.0. After installation you need to edit in your settings file like below:
DATABASES = {
'default': {
'ENGINE': 'sql_server.pyodbc',
'NAME': DB_NAME,
'USER': USER,
'PASSWORD': PASSWORD,
'HOST': HOST,
'PORT': PORT,
'OPTIONS': {
'driver': 'ODBC Driver 13 for SQL Server',
'unicode_results': True,
},
}
}
If you install TDS library as driver then your driver will be 'driver':'Free TDS' Here 13 is the default version. If your installed version is different from that then use that version number instead of 13
As stated in the django-mssql documentation, the latest release only supports Django 1.8, so it won't work with Django 1.11.
You will have to wait until the package supports newer versions of django to upgrade. That is the problem when using Django with non-supported database backends, you depend on the third party packages maintenance, and this one seems to have trouble staying up to date with Django.