问题标签 [django-mssql]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
307 浏览

python - AttributeError: module 'six' has no attribute 'memoryview' occurs when configuring django database for django-mssql

My Django is the latest version, python3.8. I want to configure the database for sql server 2008 R2, so I install django-mssql(aka,sqlserver_ado). After running the server, an error occurs:

Following this suggestion,

I open "C:\Program Files\Python38\lib\site-packages\sqlserver_ado\dbapi.py" and change "from django.utils import six" to "import six" , as well as upgrading the six module to latest version.

And this time another Error raised:

I check the six module, and yes, it doesn't include a single word named "memoryview". But why the dbapi.py include the code "Binary = six.memoryview"? And I search "six.memoryview" on Google.So many results but I can't understand.

0 投票
4 回答
1457 浏览

django - 将模型迁移到 sql server 时出现 Keyerror 'include'

我有一个 django 应用程序,并将后端作为 Microsoft sql server。为此,我安装了“pip install django-mssql-backend”。

我扩展了用户模型并添加了一个确认密码的附加字段,我正在迁移,但我遇到了错误

在此之后,我可以在下面看到在数据库中创建的两个表

  1. django_migrations
  2. django_content_type

我的模型如下:

下面是 Forms.py

Django 版本:3.2

有人可以帮忙吗。

0 投票
1 回答
73 浏览

python - 如何从 django 为 SQL Server 执行原始 sql 语句?

有效的原始数据库查询:

当我尝试从 django 执行它时

返回此错误

我也尝试过将db_name.dbo.tabledjango更改[db_name].[dbo].[table]table但没有成功。需要更改哪些内容才能正确执行原始查询?