我正在测试django项目通过ODBC连接Sql Server数据库。
我有一些问题,当我尝试做我的项目的runserver
安装的组件有:python 2.7django 1.10.2django-pyodbc 0.4.4
第一个错误是
文件"C:Python27libsite-packagesdjango_pyodbc introspection_py ",第90行,在get_table_listreturn [TableInfo(row[0].lower(), row[1]) for cursor.fetchall()]
i tried correct .django-pyodbc introspective_py with
试题:从django.db.backend .base.introspection导入baseddatabaseintrospection, FieldInfo, TableInfo,)
不是试题:从django.db.backend .base.introspection导入BaseDatabaseIntrospection
但是我有第二个错误
文件"C:Python27libsite-packagesdjangodbbackendsbasebase.py",第604行,在schema_editor中'此数据库包装器的SchemaEditorClass属性仍然为None')NotImplementedError:这个数据库包装器的SchemaEditorClass属性是仍然没有一个
我不知道如何继续。
有几个版本的django-pyodbc
在那里,听起来你正在使用一个过时的,不支持Django 1.10。目前维护最好的似乎是django-pyodbc-azure
,您可以将其与pip install django-pyodbc-azure
一起安装。我使用django-pyodbc-azure
与Django 1.10和pyodbc
3.0.10成功。
更多细节:https://github.com/michiya/django-pyodbc-azure
如果你想知道(我在使用它之前),它支持SQL Server和Azure。你不必使用Azure本身。好运!
请使用pip install "django-pyodbc-azure<1.11"
,以便您可以使用您的django版本(<1.11)并遵循页面中的说明: