djangodjango-mssql

Setting up django-mssql issues


I'm having some issues setting up django-mssql on Win Server 2008 R2. I have everything installed, however, the wiki for django-mssql says to setup the settings file similar to:

DATABASES = {
'default': {
    'NAME': 'my_database',
    'ENGINE': 'sqlserver_ado',
    'HOST': 'dbserver\\ss2008',
    'USER': '',
    'PASSWORD': '',
    'OPTIONS' : {
        'provider': 'SQLOLEDB',
        'use_mars': True,
    },
   }
}

When I run from my site directory:

 python manage.py syncdb

I get an error stating it isn't an available database backend. When I installed django-mssql it seemed to install the backend here \site-packages\django_mssql-1.0.1-py2.7.egg\sqlserver_ado does this need to be copied to site-packages\django\db\backends?

I get the same error if I set my settings to:

DATABASES = {
'default': {
    'NAME': 'my_database',
    'ENGINE': 'django_mssql-1.0.1-py2.7.egg.sqlserver_ado',
    'HOST': 'dbserver\\ss2008',
    'USER': '',
    'PASSWORD': '',
    'OPTIONS' : {
        'provider': 'SQLOLEDB',
        'use_mars': True,
    },
   }
}

Am I missing something when setting up this backend? This is my first time using django, but I didn't see anything in the documentation for setting up a different backend, and the django-mssql wiki or issues doesn't seem to have anything either.

Also, if there is other documentation somewhere that can help please let me know.

EDIT: The django app is running on Ubuntu server.


Solution

  • You will want to make sure that you can import "sqlserver_ado" from your python shell.

    Put the folder sqlserver_ado somewhere on your PATH, I put mine in \site-packages\

    Take a look at the README.txt.

    The engine does want to be set to "sqlserver_ado" similar to how the settings are done on the settings sample page.