[英]Getting ODBC error in remote server, but localhost works - Django-mssql-backend
I'm deploying a Django app in IIS, but I'm getting the following error:我正在 IIS 中部署 Django 应用程序,但出现以下错误:
('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (0) (SQLDriverConnect)') ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] 未找到数据源名称且未指定默认驱动程序 (0) (SQLDriverConnect)')
my settings.py has the following:我的 settings.py 有以下内容:
DATABASES = {
'default': {
'ENGINE': 'sql_server.pyodbc',
'NAME': 'DatabaseName',
'HOST': 'HOSTNAME',
'USER': 'username',
'PASSWORD': 'password',
'OPTIONS': {
'driver': 'ODBC Driver 13 for SQL Server',
'collation': 'SQL_Latin1_General_CP1_CI_AS',
'SERVER': 'Hostname',
'DATABASE': 'DatabaseName',
}
}
}
with this configuratio it works when I run it in my dev environment, but when I move it to deploy it doesn't work, not even when I do a manage.py runserver I have installed the following packages:使用此配置,当我在我的开发环境中运行它时它可以工作,但是当我将它移动到部署时它不起作用,即使我执行manage.py runserver我已经安装了以下软件包:
django django-filter django-msssql-backend pyodbc django django-filter django-msssql-backend pyodbc
how can I troubleshoot?我该如何排除故障? in my dev enviroment connects to the same database and server, but in the deployed location it just gives the error when trying to do runserver command.
在我的开发环境中连接到相同的数据库和服务器,但在部署位置它只是在尝试执行 runserver 命令时给出错误。
I'm connecting to a Sql server version: "Microsoft SQL Server 2014 - 12.0.2548.0 (X64)"我正在连接到 Sql 服务器版本:“Microsoft SQL Server 2014 - 12.0.2548.0 (X64)”
I have Django 3.2.4 Python 3.9.5 Django-mssql-backend 2.8.1我有 Django 3.2.4 Python 3.9.5 Django-mssql-backend 2.8.1
That error indicates that the driver you've listed can't be found on the server.该错误表明在服务器上找不到您列出的驱动程序。 So install the driver on the target server.
所以在目标服务器上安装驱动程序。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.