当我从 Django 1.8 更新到 1.11.13 时出现错误关系 "social_auth_usersocialauth" 不存在
I get the error when I updated from django 1.8 to 1.11.13 relation "social_auth_usersocialauth" does not exist
我最近将我的 django 从 1.8 更新到 1.11.13。我的应用程序 运行 与 django 1.8 完美搭配。但是当我更新时它抛出这个错误:
django.db.utils.ProgrammingError: relation "social_auth_usersocialauth" does not exist
我正在使用以下版本
python-social-auth==0.3.6
social-auth-app-django==2.1.0
social-auth-core==1.7.0
这里是堆栈跟踪
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...
我发现,在检查数据库表后,创建了 none 来自 social-auth 的表。这让我得出结论,django 没有从 INSATALLED_APPS 的列表中找到该应用程序。我浏览了文档,发现我必须将 social_django
添加到已安装的应用程序列表中。以前,我不必添加它。所以这解决了我的问题。
我最近将我的 django 从 1.8 更新到 1.11.13。我的应用程序 运行 与 django 1.8 完美搭配。但是当我更新时它抛出这个错误:
django.db.utils.ProgrammingError: relation "social_auth_usersocialauth" does not exist
我正在使用以下版本
python-social-auth==0.3.6
social-auth-app-django==2.1.0
social-auth-core==1.7.0
这里是堆栈跟踪
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...
我发现,在检查数据库表后,创建了 none 来自 social-auth 的表。这让我得出结论,django 没有从 INSATALLED_APPS 的列表中找到该应用程序。我浏览了文档,发现我必须将 social_django
添加到已安装的应用程序列表中。以前,我不必添加它。所以这解决了我的问题。