Reputation: 2011
I am getting following while running python django app(using python-odbc-azure lib) on azure web app.
ProgrammingError at /
('42S02', "[42S02] [Microsoft][ODBC Driver 13 for SQL Server][SQL
Server]Invalid object name 'app_poll'. (208) (SQLExecDirectW)")
Method: GET
Request URL: http://retailgenieredsky.azurewebsites.net/
Django Version: 1.11
Exception Type: ProgrammingError
Exception Value:
('42S02', "[42S02] [Microsoft][ODBC Driver 13 for SQL Server][SQL
Server]Invalid object name 'app_poll'. (208) (SQLExecDirectW)")
Exception Location: D:\home\python354x64\lib\site-
packages\sql_server\pyodbc\base.py in execute, line 545
Python Executable: D:\home\python354x64\python.exe
Python Version: 3.5.4
Python Path:
['.',
'D:\\home\\python354x64\\python35.zip',
'D:\\home\\python354x64\\DLLs',
'D:\\home\\python354x64\\lib',
'D:\\home\\python354x64',
'D:\\home\\python354x64\\lib\\site-packages',
'D:\\home\\site\\wwwroot']
Server time: Fri, 22 Dec 2017 13:10:47 +0000
Error during template rendering
In template D:\home\site\wwwroot\app\templates\app\layout.html, error at line 5
42S02
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <meta charset="utf-8" />
5 <meta name="viewport" content="width=device-width, initial-scale=1.0">
6 <title>{{ title }} - Django Polls</title>
7 {% load staticfiles %}
8 <link rel="stylesheet" type="text/css" href="{% static 'app/content/bootstrap.min.css' %}" />
9 <link rel="stylesheet" type="text/css" href="{% static 'app/content/site.css' %}" />
10 <script src="{% static 'app/scripts/modernizr-2.6.2.js' %}"></script>
11 </head>
12
13 <body>
14 <div class="navbar navbar-inverse navbar-fixed-top">
15 <div
class="container">
I tried following ways. 1. Remove
5
But it given same error for next line.
This is deeper level of exception.
chunked_fetch
False
cursor
<django.db.backends.utils.CursorDebugWrapper object at 0x00000064038E4F28>
params
()
result_type
'multi'
self
<sql_server.pyodbc.compiler.SQLCompiler object at 0x00000064038E4668>
sql
('SELECT TOP 5 [app_poll].[id], [app_poll].[text], [app_poll].[pub_date] FROM '
'[app_poll] ORDER BY [app_poll].[pub_date] DESC')
It seems this code is able to connect mssql database but it's not able to fetch data. Is my understanding right??
Also I ma very beginner to django , mssql and azure. Any lead is highly appreciated.
Thanks
Upvotes: 0
Views: 3451
Reputation: 2011
Exception was because azure sql server has not created tables. So needed to database migration to create table on azure to resolve this.
Upvotes: 1