2

I need help with setting up my project. I used django-pyodbc-azure and I have this in my settings.DATABASES:

DATABASES = {
    'default': { 'ENGINE': 'sql_server.pyodbc','NAME': 'DBNAME','USER': 'USER',
        'PASSWORD': 'PASSWORD',
        'HOST': '10.xx.xx.xx,1433',
        'OPTIONS': {
            'driver': 'SQL Server Native Client 10.0',
        },
    },
}

Sorry I don't know how to format the code above.

I don' know the problem is, but it returns an error:

ProgrammingError: ('42S02', "[42S02] [Microsoft][SQL Server Native Client 10.0][ SQL Server]Invalid object name 'django_session'. (208) (SQLExecDirectW); [42000] [Microsoft][SQL Server Native Client 10.0][SQL Server]Statement(s) could not be prepared. (8180)")

How do I fix this?

diiN__________
  • 7,393
  • 6
  • 42
  • 69
Jan Wilmar
  • 157
  • 4
  • 12
  • It appears you are running on Windows with the SQL Server Native Client, is that right? What version of SQL Server and Windows? Did you do an initial `python manage.py migrate`? – FlipperPA Sep 30 '16 at 20:13

1 Answers1

0

Try this:

DATABASES = {
    'default': {
        'ENGINE': 'sql_server.pyodbc',
        'NAME': 'mydb',
        'USER': 'user@myserver',
        'PASSWORD': 'password',
        'HOST': 'myserver.database.windows.net',
        'PORT': '',

        'OPTIONS': {
            'driver': 'ODBC Driver 13 for SQL Server',
        },
    },
}

source: https://pypi.python.org/pypi/django-pyodbc-azure

segalle
  • 436
  • 4
  • 15