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
相关推荐
IvorySQL5 分钟前
PostgreSQL 日报|堆表选择性索引更新(10 月 13 日)
数据库·人工智能·postgresql·开源·区块链
张洛闻Eren12 分钟前
Ansible【第一课】:Ansible介绍
运维·数据库·云原生·kubernetes·github·ansible
深圳市益普科技有限公司1 小时前
中小封装厂上 MES,为什么十个项目九个坑?
大数据·数据库·人工智能
云边云科技_云网融合1 小时前
从 POS 机到访客 Wi-Fi:零售门店安全建设的完整解法
服务器·网络·数据库
天行健,君子而铎1 小时前
知形-数据库风险监测系统:非侵入式、可溯源、差异化的数据库安全方案
网络·数据库·安全
这个DBA有点耶1 小时前
分布式事务深度:TCC空回滚、悬挂与Saga补偿风暴的根因与解法
数据库·mysql·代码规范
执笔为剑1 小时前
2.1.2-2、V8R3迁移到V8R6-迁移介绍
数据库
hiahiahia1231 小时前
Message 和对话
服务器·前端·数据库
梅雅达编程笔记2 小时前
Day 06 · 第一个 API 接口:从 Model 到 JSON
python·django·drf·后端开发·restful api·序列化器
又尔D.2 小时前
MySQL下载安装
数据库·mysql