I'm trying to connect my Django app to microsoft sql database on apache server but I get the following error messages:
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'
I have installed django-pyodbc-azure and it's showing up as part of (pip freeze list):
Django==2.1
django-pyodbc==1.1.3
django-pyodbc-azure==2.1.0.0
pyodbc==4.0.25
Here is settings.py database configuration:
'default': {
'ENGINE': 'sql_server.pyodbc',
'NAME': 'name',
'USER': 'user',
'PASSWORD': 'password',
'HOST': 'host',
'PORT': '',
'OPTIONS': {
'driver': 'ODBC Driver 17 for SQL Server',
},
},
Inside site-packages folder, it's doesn't show the actual django-pyodbc-azure folder but when i run the command (pip show django-pyodbc-azure), it shows the package location (/usr/local/lib/python3.5/dist-packages) which means it's successfully installed.
So I'm not really sure what is the problem.
I had the same problem. Somehow the installation of the azure-backend messed up my project.
I removed the django-pyodbc-azure and django-mssql-backend packages since they only support the older django versions. Afterwards i installed the mssql backend from https://github.com/microsoft/mssql-django
pip uninstall django-pyodbc-azure
pip uninstall django-mssql-backend
pip install mssql-django
Then i configured the DB to use 'ENGINE': 'mssql'
After this i was able to connect to our MSSQL DB using Django 3.2!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With