I have updated my django from 1.8 to 1.11.13 recently. My application was running perfectly with django 1.8. But when I updated it is throwing this error:
django.db.utils.ProgrammingError: relation "social_auth_usersocialauth" does not exist
I am using the following versions
python-social-auth==0.3.6
social-auth-app-django==2.1.0
social-auth-core==1.7.0
And here is the stacktrace
ERROR Internal Server Error: /account/settings/
Traceback (most recent call last):
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
psycopg2.ProgrammingError: relation "social_auth_usersocialauth" does not exist
LINE 1: ...", "social_auth_usersocialauth"."extra_data" FROM "social_au...
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/core/handlers/exception.py", line 41, in inner
response = get_response(request)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/core/handlers/base.py", line 249, in _legacy_get_response
response = self._get_response(request)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/core/handlers/base.py", line 217, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/core/handlers/base.py", line 215, in _get_response
response = response.render()
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/template/response.py", line 107, in render
self.content = self.rendered_content
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/template/response.py", line 84, in rendered_content
content = template.render(context, self._request)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/template/backends/django.py", line 66, in render
return self.template.render(context)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/template/base.py", line 207, in render
return self._render(context)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/test/utils.py", line 107, in instrumented_test_render
return self.nodelist.render(context)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/template/base.py", line 990, in render
bit = node.render_annotated(context)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/template/base.py", line 957, in render_annotated
return self.render(context)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/template/loader_tags.py", line 177, in render
return compiled_parent._render(context)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/test/utils.py", line 107, in instrumented_test_render
return self.nodelist.render(context)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/template/base.py", line 990, in render
bit = node.render_annotated(context)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/template/base.py", line 957, in render_annotated
return self.render(context)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/template/loader_tags.py", line 177, in render
return compiled_parent._render(context)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/test/utils.py", line 107, in instrumented_test_render
return self.nodelist.render(context)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/template/base.py", line 990, in render
bit = node.render_annotated(context)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/template/base.py", line 957, in render_annotated
return self.render(context)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/template/defaulttags.py", line 411, in render
return strip_spaces_between_tags(self.nodelist.render(context).strip())
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/template/base.py", line 990, in render
bit = node.render_annotated(context)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/template/base.py", line 957, in render_annotated
return self.render(context)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/template/loader_tags.py", line 72, in render
result = block.nodelist.render(context)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/template/base.py", line 990, in render
bit = node.render_annotated(context)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/template/base.py", line 957, in render_annotated
return self.render(context)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/template/loader_tags.py", line 72, in render
result = block.nodelist.render(context)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/template/base.py", line 990, in render
bit = node.render_annotated(context)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/template/base.py", line 957, in render_annotated
return self.render(context)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/template/loader_tags.py", line 72, in render
result = block.nodelist.render(context)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/template/base.py", line 990, in render
bit = node.render_annotated(context)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/template/base.py", line 957, in render_annotated
return self.render(context)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/template/defaulttags.py", line 529, in render
return self.nodelist.render(context)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/template/base.py", line 990, in render
bit = node.render_annotated(context)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/template/base.py", line 957, in render_annotated
return self.render(context)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/template/defaulttags.py", line 321, in render
if match:
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/db/models/query.py", line 254, in __bool__
self._fetch_all()
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/db/models/query.py", line 1118, in _fetch_all
self._result_cache = list(self._iterable_class(self))
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/db/models/query.py", line 53, in __iter__
results = compiler.execute_sql(chunked_fetch=self.chunked_fetch)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/db/models/sql/compiler.py", line 899, in execute_sql
raise original_exception
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/db/models/sql/compiler.py", line 889, in execute_sql
cursor.execute(sql, params)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/db/backends/utils.py", line 79, in execute
return super(CursorDebugWrapper, self).execute(sql, params)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/db/utils.py", line 94, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/utils/six.py", line 685, in reraise
raise value.with_traceback(tb)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
django.db.utils.ProgrammingError: relation "social_auth_usersocialauth" does not exist
LINE 1: ...", "social_auth_usersocialauth"."extra_data" FROM "social_au...
I figured out, after inspecting the database tables, that none of the tables from social-auth were created. This led me conclude that django did not find the app from the list of INSATALLED_APPS. I went through the documentation and found out that I have to add social_django
to the list of installed apps. Previously, I did not have to add that. So this solved my problem.