ESSolutions / django-mssql-backend

Django backend for Microsoft SQL Server
https://pypi.org/project/django-mssql-backend/
BSD 3-Clause "New" or "Revised" License
147 stars 51 forks source link

'sql_server.pyodbc' isn't an available database backend. #37

Open schacki opened 4 years ago

schacki commented 4 years ago

Hi all,

I get the following error when doing runserver:

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'

My configuration in settings is like that:

{'NAME': '***',
  'USER': '***',
  'PASSWORD': '***',
  'HOST': '192.168.10.70',
  'PORT': '',
  'ENGINE': 'sql_server.pyodbc',
  'OPTIONS': {'driver': 'ODBC Driver 17 for SQL Server'}
}

The library seems to be installed, this import works without errors: import sql_server.pyodbc

Any help appreciated.

ngluva commented 4 years ago

Did you manage to resolve this problem?

davidjb commented 4 years ago

I had the same issue and symptoms on Django 3.0.3, packages installed via pipenv. In my case, I was using the original django-pyodbc-azure package and switched over to django-mssql-backend. For me, I had installed the new package and then uninstalled the old one, meaning that I had a conflict because both packages use the same namespace. In other words, sql_server.pyodbc could be imported fine but it was an empty module which caused Django to error here as sql_server.pyodbc.base couldn't be imported. I solved my issue with:

pipenv uninstall django-mssql-backend
pipenv install django-mssql-backend
Carl-Chan commented 4 years ago

Same Here.

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 installed below Package: django django-redis-cache django-mssql-backend

Is below Package requried? pyodbc (also try to add and remove this package but raise the same exception)

Any idea?

Thanks.

rafaelreuber commented 4 years ago

I my case, I was using django 2.1.7. But the minimum version required is 2.2. The problem was solved after I update my project to use django == 2.2.16

eckad158 commented 3 years ago

There is a fork of this project that supports Django 3.2 : https://github.com/microsoft/mssql-django

lewisMachilika commented 2 years ago

I had the same issue and symptoms on Django 3.0.3, packages installed via pipenv. In my case, I was using the original django-pyodbc-azure package and switched over to django-mssql-backend. For me, I had installed the new package and then uninstalled the old one, meaning that I had a conflict because both packages use the same namespace. In other words, sql_server.pyodbc could be imported fine but it was an empty module which caused Django to error here as sql_server.pyodbc.base couldn't be imported. I solved my issue with:

pipenv uninstall django-mssql-backend
pipenv install django-mssql-backend

This one worked for me