Django3.0+ connects to SQL Server

What should I do to make Django3.0+ connects to SQL Server?
When I follow “https://pypi.org/project/django-mssql-backend/” step by step, It tells me that it can support Django 2.2, 3.0 and depend on Django 2.2 or newer.
But When I follow “https://pypi.org/project/django-pyodbc-azure/” to install “django-pyodbc-azure” ,It tells me that it just supports Django 2.1.


So,how can I do now?Can someone help me?!!!

You only one of them. Try django-mssql-backend ?

I have tried django-mssql-backend only,but it said I should install django-pyodbc-azure.
And I also tried django-pyodbc-azure only,it was a definite failure…

My installation records and Settings are as follows:

Hi

Are you running django in a virtual environment? I created a virtual environment in windows and ran pip install django-mssql-backend and I ran pip freeze after which showed me that pyodbc was installed so your pyodbc error suggests you are not?

The django-mssql-backend docs say:

django-mssql-backend is a fork of django-pyodbc-azure

A “fork” is an updated copy. Therefore you should only install django-mssql-backend. If you installed django-pyodbc-azure, you should try uninstalling both of them then installing only django-mssql-backend.

django-mssql-backend’s installation instructions say:

Installation

  1. Install pyodbc and Django
  2. Install django-mssql-backend

You’re seeing this error:

Error loading pyodbc module: No module named ‘pyodbc’

This means that you haven’t installed pyodbc as per step 1.

That library is here: pyodbc · PyPI

I think if you pip install pyodbc it should work.

@chriswedgwood is correct - installing django-mssql-backend should install pyodbc automatically. This is because it’s in its install_requires declaration: https://github.com/ESSolutions/django-mssql-backend/blob/master/setup.py#L27 .

I’m running diango in my desktop.Adopted @adamchainz’s suggestion,which try uninstalling both of them then installing only django-mssql-backend,it works!

It works!!! Thank a lot.

1 Like