1、我用的是sqlserver
需要安装sql-server.pyodbc、django-pyodbc-azure库
# setting.py
DATABASES = {
'default': {
'ENGINE': 'sql_server.pyodbc',
'NAME': 'books',
'USER': 'sa',
'PASSWORD': '1234',
'HOST': 'localhost', # example: 'localhost' or your server IP address
'PORT': '1433', # example: '1433' for SQL Server 2017 or 11433 for SQL Server Express
'OPTIONS': {
'driver': 'SQL Server Native Client 10.0', # you may need to change this depending on your ODBC driver
},
},
}
2、driver驱动去电脑的“数据源管理程序(64位)”查看,或者添加,按提示直接设置就好,菜单直接搜索 “数据源管理程序(64位)”