无法使用pyodbc使用django 1.4应用程序连接到sql server 2008

时间:2022-06-07 11:50:01

we are unable to connect with the following error when we try using the django shell;

当我们尝试使用django shell时,我们无法连接以下错误;

TypeError: init() takes exactly 2 arguments (1 given)

TypeError:init()只需要2个参数(给定1个)

Our database settings file looks like this;

我们的数据库设置文件如下所示;

DATABASE_ENGINE = 'sql_server.pyodbc'                   #  'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
#DATABASE_ODBC_DSN = 'websiteredesign'
#DATABASE_ODBC_DRIVER = 'FreeTDS'
DATABASE_NAME = db             # Or path to database file if using sqlite3.
DATABASE_USER = db             # Not used with sqlite3.
DATABASE_PASSWORD = 'dcls'         # Not used with sqlite3.
DATABASE_HOST = '10.64.4.135'  # Set to empty string for localhost. Not used with sqlite3.
DATABASE_PORT = '1433'
DATABASE_OPTIONS = {
    'driver': 'FreeTDS',
    'dsn': 'dcls',
    'host_is_server': True,
    'extra_params': 'TDS_VERSION=8.0'
}

DATABASES = {
    'default': {
        'ENGINE': DATABASE_ENGINE,
        'NAME': DATABASE_NAME,
        'USER': DATABASE_USER,
        'PASSWORD': DATABASE_PASSWORD,
        'HOST': DATABASE_HOST,
        'PORT': DATABASE_PORT,
        'OPTIONS': DATABASE_OPTIONS,
    },
    'dcls': {
        'ENGINE': DATABASE_ENGINE,
        'NAME': DATABASE_NAME,
        'USER': DATABASE_USER,
        'PASSWORD': DATABASE_PASSWORD,
        'HOST': DATABASE_HOST,
        'PORT': DATABASE_PORT,
        'OPTIONS': DATABASE_OPTIONS,
    }
}

You can ignore some of the duplication. that was just some tests we did. Nothing seems to help. We ported over from a working django 1.3 system that is working. any help would be appreciated.

您可以忽略一些重复。这只是我们做过的一些测试。似乎没有任何帮助。我们从正在运行的工作django 1.3系统移植过来。任何帮助,将不胜感激。

Thanks, Bobby

1 个解决方案

#1


0  

There were a number of DB changes in 1.4 (timezones and bulk inserts to start) which required changes in the third-party backends. However it looks like django-pyodbc has not seen a commit in over a year. As of this writing the last commit was in June 2011. This most likely means that django-pyodbc is not compatible with 1.4.

1.4中有许多数据库更改(启动时区和批量插入),这需要更改第三方后端。然而,看起来django-pyodbc在一年多的时间里没有看到过承诺。截至本文撰写时,最后一次提交是在2011年6月。这很可能意味着django-pyodbc与1.4不兼容。

#1


0  

There were a number of DB changes in 1.4 (timezones and bulk inserts to start) which required changes in the third-party backends. However it looks like django-pyodbc has not seen a commit in over a year. As of this writing the last commit was in June 2011. This most likely means that django-pyodbc is not compatible with 1.4.

1.4中有许多数据库更改(启动时区和批量插入),这需要更改第三方后端。然而,看起来django-pyodbc在一年多的时间里没有看到过承诺。截至本文撰写时,最后一次提交是在2011年6月。这很可能意味着django-pyodbc与1.4不兼容。