Skip to content

Getting started

Warren Chu edited this page Jan 4, 2021 · 9 revisions

Installation for Windows

  1. Install pyodbc 3.0 (or newer) and Django 2.2 (or newer)

  2. Install django-mssql-backend ::

    pip install django-mssql-backend

  3. Set the ENGINE setting in the settings.py file used by your Django application or project to 'mssql' module path ::

    'ENGINE': 'mssql'

Installation for Linux

  1. Install pyodbc 3.0 (or newer) and Django 2.2 (or newer)

  2. Install Microsoft ODBC Driver 17 for SQL Server (or equivalent)

  3. Install django-mssql-backend ::

    pip install django-mssql-backend

  4. Set the ENGINE setting in the settings.py file used by your Django application or project to 'mssql' module path ::

    'ENGINE': 'mssql'

Example

Here is an example of the database settings:

`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',
    },
},

}

set this to False if you want to turn off pyodbc's connection pooling

DATABASE_CONNECTION_POOLING = False`

Clone this wiki locally