Since version 2.1 has been marked as insecure I need to upgrade at least to >=2.2. Github security suggests installing 2.2.13. I also need to install other packages that only work with Django >=2.2.
The Django upgrade is successful but when pipenv tries to lock the dependencies I get this error:
Warning: Your dependencies could not be resolved. You likely have a mismatch in your sub-dependencies.
I googled this and the only way I stop getting this error is by placing these two dependencies under [dev-packages]:
django-pyodbc-azure = "<2.1"
django-pyodbc = "<2.1"
But when I try to run the server I get this:
ImproperlyConfigured("Django %d.%d.%d is not supported." % VERSION[:3])
django.core.exceptions.ImproperlyConfigured: Django 2.2.13 is not supported.
I also googled this and the solution that shows up is to manually change the conditions for raising this error. I do that and then I get this other error:
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 googled this too but the solutions that worked for other people didn't work for me. I've been stuck at this point for days. Please send help!
Other info: I am using these two params:
ENGINE':'sql_server.pyodbc'
'driver': 'ODBC Driver 17 for SQL Server'
Note: If you know another way I can use these packages with a newer version of Django please share it.
django-pyodbc-azure
is no longer maintained, unfortunately. There's a new package you can use which works as a drop-in replacement. It supports Django 2.2 and 3.0.
https://pypi.org/project/django-mssql-backend/
I'd recommend that you entirely remove all references to pyodbc
, django-pyodbc
, and django-pyodbc-azure
. Then update your dependencies (for example, in a Pipfile
or requirements.txt
) to add:
django-mssql-backend==2.8.1
django>=2.2,<3
Give that a try in a new virtual environment when you get a chance to ensure you don't have django-pyodbc-azure
hanging around. If you have any further problems we can work through them in comments and amend the answer. I don't think you'll need it, but I have a more in depth guide available here: https://www.pyphilly.org/django-and-sql-server-2020-edition/