简体   繁体   English

在远程服务器中获取 ODBC 错误,但本地主机有效 - Django-mssql-backend

[英]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.

相关问题 使用 Django 后端在前端获取 CORS 错误 - Getting CORS error in frontend with Django backend python flask 请求在本地主机上有效,但在远程服务器上无效 - python flask requests works on localhost but does not work on remote server 将 Django 与 MSSQL 服务器连接 - Connecting Django with MSSQL server Django mongoengine无法连接到远程服务器,始终连接到本地主机 - Django mongoengine not connect to remote server, always connect to localhost 如何在不出现Unsupported media type错误的情况下将数据从React表单发送到Django后端服务器? - How to send data from React form to Django backend server without getting the Unsupported media type error? django-mptt子项选择在localhost上有效,但在服务器上不起作用 - django-mptt children selection works on localhost but not on server 将django-mssql连接到mssql服务器(azure) - Connecting django-mssql to mssql server (azure) "为什么在使用 Heroku 部署 Django 时出现内部服务器错误(管理页面仍然有效)?" - Why am I getting an internal server error when deploying Django with Heroku (admin page still works)? 实时服务器上的未知错误,但该模块在本地主机上运行良好 - an unknown error on a live server but the module works very well on localhost Django后端未在生产服务器上返回JSON,得到404 - Django backend not returning JSON on production server, getting 404
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM