I am trying to set up my Django site using Azure Websites (not an Azure VM). I got a site with some static pages up and running, and I created an Azure SQL Database, but how do I connect the Django site to use the Azure db?
Asked
Active
Viewed 610 times
2 Answers
3
django-pyodbc-azure is a refined fork of django-pyodbc, a Django MS SQL Server external DB backend that uses ODBC by employing the pyodbc library. It supports MS SQL Server and Windows Azure SQL Database.
Features
- Supports Django 1.9.6
- Supports Microsoft SQL Server 2005, 2008/2008R2, 2012, 2014, 2016 and Azure SQL Database
- Supports LIMIT+OFFSET and offset w/o LIMIT emulation.
- Passes most of the tests of the Django test suite.
- Compatible with SQL Server , SQL Server Native Client , Micosoft ODBC Driver 11 for SQL Server on Windows and FreeTDS ODBC drivers.

ndpu
- 22,225
- 6
- 54
- 69
0
I understand you can use something like the following in your settings.py
file
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': os.environ['DBNAME'],
'HOST': hostname + ".postgres.database.azure.com",
'USER': os.environ['DBUSER'] + "@" + hostname,
'PASSWORD': os.environ['DBPASS']
}
}

Jeremy Caney
- 7,102
- 69
- 48
- 77

Satch421
- 1
- 3