For the past few weeks I have been developing a Django web app on Windows environment and now I am trying to deploy it to AWS.
The app's data base is a Azure SQL database and the configuration in the setting.py
file is like this:
DATABASES = {
'default': {
'ENGINE': 'sql_server.pyodbc',
'NAME': 'nameofdatabase',
'HOST': 'nameofdatabase.database.windows.net',
'PORT': '1433',
'USER': 'user',
'PASSWORD': 'password',
'OPTIONS': {
'driver': 'ODBC Driver 13 for SQL Server',
}
}
}
And this is the error I got when trying to access the app. I set DEBUG=TRUE
so I can see the exception here.
Django Version: 2.1.3
Exception Type: InterfaceError
Exception Value: ('IM002', '[IM002] [unixODBC][Driver Manager]Data source name not found, and no default driver specified (0) (SQLDriverConnect)')
Exception Location: /opt/python/run/venv/local/lib/python3.6/site-packages/sql_server/pyodbc/base.py in get_new_connection, line 307
Python Executable: /opt/python/run/venv/bin/python3
Python Version: 3.6.7
I know this is something to do with the pyodbc
package or SQL driver
as well as unixodbc
on Amazon Linux.
I'm quite new to programming so hope you guys can shed some light. Thank you!