简体   繁体   English

python3.6.2 + django1.11.4 + django-mssql1.8-此组合是否支持? 无法从Django连接SQL Server

[英]python3.6.2 + django1.11.4 + django-mssql1.8 - is this combination supports? Unable to connect sql server from django

I am using pthon3.6.2 + django1.11.4 + django-mssql1.8 combination for my web application and unable to connect to sql server database. 我正在为我的Web应用程序使用pthon3.6.2 + django1.11.4 + django-mssql1.8组合,但无法连接到sql server数据库。 Following is the setting I am using in setting.py 以下是我在setting.py中使用的设置

DATABASES = {
    'default': {
        'NAME': 'DB1',
        'ENGINE': 'sqlserver_ado',
        'HOST': '192.168.5.245',
        'USER': 'user1',
        'PASSWORD': '123456',
    }
}
  1. Is this combination supports? 这个组合支持吗? ie django-mssql1.8 is supported or not with other two. 即django-mssql1.8是否受其他两个支持。 The django-mssql website does not mention this django-mssql网站未提及此
  2. If it supports please advise how to resolve. 如果支持,请告知如何解决。

I am getting the following error : 我收到以下错误:

在此处输入图片说明

Finally I got the solution. 终于我找到了解决方案。 I still don't know whether that combination supports or not. 我仍然不知道该组合是否支持。 Instead of django-mssql I am using django-pyodbc-azure 1.11.0.0 我正在使用django-pyodbc-azure 1.11.0.0而不是django-mssql

Installation : 安装方式

pip install django-pyodbc-azure

Following is the code at settings.py. 以下是settings.py中的代码。 It workis properly. 它工作正常。

'default': {
        'NAME': 'DB1',
        'ENGINE': 'sql_server.pyodbc',
        'HOST': '192.168.5.245',
        'USER': 'user1',
        'PASSWORD': '123456',
        'OPTIONS' : {
            'driver' : 'SQL Server Native Client 11.0'
        }
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM