嗨,我在使用 inspectdb
时遇到AttributeError
.
- 平台操作系统:视窗
- 姜戈版本:1.7
- 数据库:MS-SQL 2008
请帮助我。谢谢。
错误:
from django.db import models
Traceback (most recent call last):
File "manage.py", line 10, in <module> execute_from_command_line(sys.argv)
File "C:Python27libsite-packagesdjangocoremanagement__init__.py", line 338, in execute_from_command_line utility.execute()
File "C:Python27libsite-packagesdjangocoremanagement__init__.py", line 330, in execute self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:Python27libsite-packagesdjangocoremanagementbase.py", line 390, in run_from_argv self.execute(*args, **cmd_options)
File "C:Python27libsite-packagesdjangocoremanagementbase.py", line 442, in execute output = self.handle(*args, **options)
File "C:Python27libsite-packagesdjangocoremanagementcommandsinspectdb.py", line 25, in handle for line in self.handle_inspection(options):
File "C:Python27libsite-packagesdjangocoremanagementcommandsinspectdb.py", line 55, in handle_inspection for table_name in connection.introspection.table_names(cursor):
File "C:Python27libsite-packagesdjangodbbackends__init__.py", line 1310, in table_names return get_names(cursor)
File "C:Python27libsite-packagesdjangodbbackends__init__.py", line 1306, in get_names if include_views or ti.type == 't'])
AttributeError: 'unicode' object has no attribute 'type'
数据库设置:
DATABASES = {
'default': {
'ENGINE': 'sqlserver_ado',
'HOST': 'DB_SERVER',
'NAME': 'DB_NAME',
'USER': 'SOME_USER',
'PASSWORD': 'SOMEONE_PASSWORD',
}
}
现在我能够连接到MS SQL Server,手动创建模型。