我想使用現有的mssql數據庫。我用inspectdb命令,但它不工作inspectdb命令但它不起作用
這是我的數據庫配置:
DATABASES = {
'default': {
'NAME': 'xxxx',
'ENGINE': 'sqlserver_ado',
'HOST': '102.35.140.54\SQLEXPRESS',
'USER': 'xxxx',
'PASSWORD': 'xxxxx',
'PORT' : '1434',
'OPTIONS': {
'provider': 'SQLNCLI11',
}
}
}
我解僱python manage.py inspectdb
,並得到錯誤。
D:\Python_Workspace\oracle>python manage.py migrate
Traceback (most recent call last):
File "manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File "C:\Python35\lib\site-packages\django\core\management\__init__.py", line 367, in execute_from_command_line
utility.execute()
File "C:\Python35\lib\site-packages\django\core\management\__init__.py", line 359, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Python35\lib\site-packages\django\core\management\base.py", line 294, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Python35\lib\site-packages\django\core\management\base.py", line 345, in execute
output = self.handle(*args, **options)
File "C:\Python35\lib\site-packages\django\core\management\commands\migrate.py", line 83, in handle
executor = MigrationExecutor(connection, self.migration_progress_callback)
File "C:\Python35\lib\site-packages\django\db\migrations\executor.py", line 20, in __init__
self.loader = MigrationLoader(self.connection)
File "C:\Python35\lib\site-packages\django\db\migrations\loader.py", line 52, in __init__
self.build_graph()
File "C:\Python35\lib\site-packages\django\db\migrations\loader.py", line 203, in build_graph
self.applied_migrations = recorder.applied_migrations()
File "C:\Python35\lib\site-packages\django\db\migrations\recorder.py", line 65, in applied_migrations
self.ensure_schema()
File "C:\Python35\lib\site-packages\django\db\migrations\recorder.py", line 52, in ensure_schema
if self.Migration._meta.db_table in self.connection.introspection.table_names(self.connection.cursor()):
File "C:\Python35\lib\site-packages\django\db\backends\base\base.py", line 231, in cursor
cursor = self.make_debug_cursor(self._cursor())
File "C:\Python35\lib\site-packages\django\db\backends\base\base.py", line 204, in _cursor
self.ensure_connection()
File "C:\Python35\lib\site-packages\django\db\backends\base\base.py", line 199, in ensure_connection
self.connect()
File "C:\Python35\lib\site-packages\django\db\backends\base\base.py", line 170, in connect
conn_params = self.get_connection_params()
File "C:\Python35\lib\site-packages\sqlserver_ado\base.py", line 225, in get_connection_params
'connection_string': make_connection_string(settings_dict),
File "C:\Python35\lib\site-packages\sqlserver_ado\base.py", line 56, in make_connection_string
raise ImproperlyConfigured("When using DATABASE PORT, DATABASE HOST must be an IP address.")
django.core.exceptions.ImproperlyConfigured: When using DATABASE PORT, DATABASE HOST must be an IP address.
嗨請檢查分貝主機請使用IP或主機名稱 –