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
相关推荐
冬奇Lab10 小时前
每日一个开源项目(第134篇):Zvec - 阿里开源的嵌入式向量数据库,向量搜索界的 SQLite
数据库·人工智能·llm
ClouGence21 小时前
Oracle CDC 架构优化:从主库直连到 DataGuard 备库同步
数据库·后端·oracle
无响应de神1 天前
三、用户与权限管理
数据库·mysql
麦聪聊数据2 天前
数据服务化时代:企业数据能力输出的核心路径
数据库
shushangyun_2 天前
2026年快消品B2B系统推荐:支持终端门店订货、促销政策自动化的工具?
java·运维·网络·数据库·人工智能·spring·自动化
DARLING Zero two♡2 天前
【MySQL数据库】数据类型与表约束
数据库·mysql
曹牧2 天前
Oracle EXPLAIN PLAN
数据库·oracle
BD_Marathon2 天前
SQL学习指南——视图
数据库·sql
活宝小娜2 天前
mysql详细安装教程
数据库·mysql·adb
贤时间2 天前
codex 助力oracle ebs 开发
数据库·oracle