Django 连接(sqlserver)数据库方法

文章目录

Django只内置了几个 Database Backend(mysql、oracle、sqllite3(默认)、postgresql_psycopg2),所以原生并不支持Microsoft SQL Server

django 的SQL server适配器,例如django-pyodbc-azure 或 mssql-django

1、django-pyodbc-azure

2、mssql-django


具体的选择根据自己python 和 django 的版本决定

3、注意

如果使用mssql引擎 启动项目时报错

python 复制代码
django.core.exceptions.ImproperlyConfigured: 'mssql' isn't an available database backend or couldn't be imported. Check the above exception. To use one of the built-in
backends, use 'django.db.backends.XXX', where XXX is one of:
    'mysql', 'oracle', 'postgresql', 'sqlite3'

需注意自己安装的版本是否正确

亲测有效

python 复制代码
python 3.8
django 4.2.14
pyodbc==5.2.0
mssql-django==1.5
python 复制代码
python 3.8
Django==3.2.25
pymssql==2.3.1
pyodbc==5.1.0
相关推荐
经典199221 分钟前
mysql 锁介绍
数据库·mysql
不太可爱的大白22 分钟前
Mysql分片:一致性哈希算法
数据库·mysql·算法·哈希算法
LuckyLay23 分钟前
1.1.2 运算符与表达式——AI教你学Django
python·django
~ 小团子23 分钟前
每日一SQL 【游戏玩法分析 IV】
数据库·sql·游戏
学不会就看24 分钟前
Django--01基本请求与响应流程
后端·python·django
零叹27 分钟前
MySQL——常用程序and主从复制
数据库·mysql
Favor_Yang3 小时前
SQL Server通过存储过程调用DLL程序集发送飞书卡片消息
sqlserver·飞书·存储过程
胚芽鞘6814 小时前
关于java项目中maven的理解
java·数据库·maven
sun0077008 小时前
mysql索引底层原理
数据库·mysql
workflower10 小时前
MDSE和敏捷开发相互矛盾之处:方法论本质的冲突
数据库·软件工程·敏捷流程·极限编程