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
相关推荐
兮兮能吃能睡8 分钟前
SQL中常见的英文术语及其含义
数据库·sql·oracle
Elastic 中国社区官方博客1 小时前
根据用户行为数据中的判断列表在 Elasticsearch 中训练 LTR 模型
大数据·数据库·人工智能·elasticsearch·搜索引擎·ai·全文检索
王道长服务器 | 亚马逊云3 小时前
AWS CloudWatch:服务器的“眼睛”,实时监控一切动向
服务器·数据库·aws
怪兽20145 小时前
什么是 Redis?
java·数据库·redis·缓存·面试
wangmengxxw6 小时前
Redis概述
数据库·redis·缓存
笔生花6 小时前
【实战-12】flink版本表
数据库·sql·flink
workflower6 小时前
Fundamentals of Architectural Styles and patterns
开发语言·算法·django·bug·结对编程
花月C6 小时前
高效查找数据的数据结构—MySQL 索引
数据结构·数据库·mysql
我笔记6 小时前
关系型数据库RDBMS与非关系型数据库NoSQL区别
数据库·oracle
PiscesCanon7 小时前
达梦开启awr功能报错:[-7160]:Object [DBMS_WORKLOAD_REPOSITORY_DATA_LOW] is invalid
数据库·mysql