I have already tried out all the suggestions in other posts.
I am trying to connect SQL Server to Django on a Linux CentOS 7 with a virtual environment.
I am getting the following error:
) from e_user
django.core.exceptions.ImproperlyConfigured: 'sql_server.pyodbc' isn't an available database backend.
Try using 'django.db.backends.XXX', where XXX is one of:
'mysql', 'oracle', 'postgresql', 'sqlite3'
The setting are the following:
Django==2.1.15
django-bootstrap3==14.2.0
django-db-tools==0.0.1
django-filter==2.4.0
django-mathfield==0.1.0
django-model-utils==4.1.1
django-mssql-backend==2.8.1
django-pyodbc-azure==2.1.0.0
django-tables2==2.3.4
django-widget-tweaks==1.4.8
importlib-metadata==1.7.0
pyodbc==4.0.30
pytz==2020.5
sql-server.pyodbc==1.0
sqlparse==0.4.1
zipp==3.4.0
This is my odbcins.ini file:
[ODBC Driver 17 for SQL Server]
Description=Microsoft ODBC Driver 17 for SQL Server
Driver=/opt/microsoft/msodbcsql17/lib64/libmsodbcsql-17.6.so.1.1
UsageCount=1
This is the odbc.ini
Driver = ODBC Driver 17 for SQL Server
Server = IP
Database = dbNAME
Trace = Yes
TraceFile = /tmp/odbc.log
And my settings.py
DATABASES = {
'default': {
'ENGINE' : 'sql_server.pyodbc',
'NAME': 'dbNAME',
'HOST' : 'IP',
'PORT' : '8000',
'USER': 'username',
'PASSWORD': 'passwrd',
'OPTIONS': {
'driver': 'ODBC Driver 17 for SQL Server',
},
},
}
I have tried out to reinstall django-pyodbc-azure as they suggested here Django python 'sql_server.pyodbc' isn't an available database backend
but it didn't work for me. I also tried to reinstall the ODBC driver.
Appreciate your help Thanks