Django with database on SQL Server

By way of ODBC connections.

  1.python mounting django-pyodbc-azure

  2. Create ODBC data source:

    Control Panel "Administrative Tools" the ODBC data source (64) "the DSN System" Add "Select 'SQL server', select the server '(local)', then been ok

  3.django in setting.py file:

    

 1 DATABASES = {
 2     'default': {
 3         'ENGINE': 'sql_server.pyodbc',
 4         'NAME': '',
 5         'HOST': '127.0.0.1',
 6         'PORT': '1433',
 7         'USER': '',
 8         'PASSWORD': '' ,
 . 9          ' the OPTIONS ' : {
 10                      ' Driver ' : ' the SQL Server Native Client 11.0 ' , # when SQLSERVER herein may be selected from the version 2 is seen 
. 11                      ' MARS_Connection ' : True,
 12 is                  },
 13 is      }

  4. Test connector.

    

Guess you like

Origin www.cnblogs.com/allen-zqw/p/11628123.html