On 12/6/23 14:49, Jered Floyd wrote:
The difference in behavior was using social login buttons for an existing account vs. creating a new account.
This is another damn django-allauth regression, starting in 0.57.0. It seem to be this commit that is to blame: https://github.com/pennersr/django-allauth/commit/be779dfee5a328a3a42edc2c95...
In allauth/socialaccount/models.py:lookup(self):285 there is an attempt to look up the social account as one that already exists. If that fails, this commit calls self.account.get_provider() without passing the request object, which leads to the eventual error.
I believe this is a django-allauth bug, and have submitted a pull request to fix it here: https://github.com/pennersr/django-allauth/pull/3548
Thanks for all your work on this. It is much appreciated. However, your patch doesn't fix my issue with the URL https://example.com/accounts/social/connections/ which still produces the following:
ERROR 2023-12-07 00:05:55,032 169452 django.request Internal Server
Error: /accounts/social/connections/
Traceback (most recent call last):
File
"/opt/mailman/mm/venv/lib/python3.9/site-packages/django/core/handlers/exception.py",
line 55, in inner
response = get_response(request)
File
"/opt/mailman/mm/venv/lib/python3.9/site-packages/django/core/handlers/base.py",
line 220, in _get_response
response = response.render()
File
"/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/response.py",
line 114, in render
self.content = self.rendered_content
File
"/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/response.py",
line 92, in rendered_content
return template.render(context, self._request)
File
"/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/backends/django.py",
line 61, in render
return self.template.render(context)
File
"/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py",
line 175, in render
return self._render(context)
File
"/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py",
line 167, in _render
return self.nodelist.render(context)
File
"/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py",
line 1005, in render
return SafeString("".join([node.render_annotated(context) for node
in self]))
File
"/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py",
line 1005, in <listcomp>
return SafeString("".join([node.render_annotated(context) for node
in self]))
File
"/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py",
line 966, in render_annotated
return self.render(context)
File
"/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/loader_tags.py",
line 157, in render
return compiled_parent._render(context)
File
"/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py",
line 167, in _render
return self.nodelist.render(context)
File
"/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py",
line 1005, in render
return SafeString("".join([node.render_annotated(context) for node
in self]))
File
"/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py",
line 1005, in <listcomp>
return SafeString("".join([node.render_annotated(context) for node
in self]))
File
"/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py",
line 966, in render_annotated
return self.render(context)
File
"/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/loader_tags.py",
line 157, in render
return compiled_parent._render(context)
File
"/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py",
line 167, in _render
return self.nodelist.render(context)
File
"/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py",
line 1005, in render
return SafeString("".join([node.render_annotated(context) for node
in self]))
File
"/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py",
line 1005, in <listcomp>
return SafeString("".join([node.render_annotated(context) for node
in self]))
File
"/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py",
line 966, in render_annotated
return self.render(context)
File
"/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/loader_tags.py",
line 157, in render
return compiled_parent._render(context)
File
"/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py",
line 167, in _render
return self.nodelist.render(context)
File
"/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py",
line 1005, in render
return SafeString("".join([node.render_annotated(context) for node
in self]))
File
"/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py",
line 1005, in <listcomp>
return SafeString("".join([node.render_annotated(context) for node
in self]))
File
"/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py",
line 966, in render_annotated
return self.render(context)
File
"/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/loader_tags.py",
line 63, in render
result = block.nodelist.render(context)
File
"/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py",
line 1005, in render
return SafeString("".join([node.render_annotated(context) for node
in self]))
File
"/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py",
line 1005, in <listcomp>
return SafeString("".join([node.render_annotated(context) for node
in self]))
File
"/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py",
line 966, in render_annotated
return self.render(context)
File
"/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/loader_tags.py",
line 63, in render
result = block.nodelist.render(context)
File
"/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py",
line 1005, in render
return SafeString("".join([node.render_annotated(context) for node
in self]))
File
"/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py",
line 1005, in <listcomp>
return SafeString("".join([node.render_annotated(context) for node
in self]))
File
"/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py",
line 966, in render_annotated
return self.render(context)
File
"/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/defaulttags.py",
line 321, in render
return nodelist.render(context)
File
"/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py",
line 1005, in render
return SafeString("".join([node.render_annotated(context) for node
in self]))
File
"/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py",
line 1005, in <listcomp>
return SafeString("".join([node.render_annotated(context) for node
in self]))
File
"/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py",
line 966, in render_annotated
return self.render(context)
File
"/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/defaulttags.py",
line 238, in render
nodelist.append(node.render_annotated(context))
File
"/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py",
line 966, in render_annotated
return self.render(context)
File
"/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/defaulttags.py",
line 539, in render
values = {key: val.resolve(context) for key, val in
self.extra_context.items()}
File
"/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/defaulttags.py",
line 539, in <dictcomp>
values = {key: val.resolve(context) for key, val in
self.extra_context.items()}
File
"/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py",
line 715, in resolve
obj = self.var.resolve(context)
File
"/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py",
line 847, in resolve
value = self._resolve_lookup(context)
File
"/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py",
line 914, in _resolve_lookup
current = current()
File
"/opt/mailman/mm/venv/lib/python3.9/site-packages/allauth/socialaccount/models.py",
line 147, in get_provider_account
return self.get_provider().wrap_account(self)
File
"/opt/mailman/mm/venv/lib/python3.9/site-packages/allauth/socialaccount/models.py",
line 141, in get_provider
provider = self._provider = adapter.get_provider(
File
"/opt/mailman/mm/venv/lib/python3.9/site-packages/allauth/socialaccount/adapter.py",
line 204, in get_provider
app = self.get_app(request, provider=provider)
File
"/opt/mailman/mm/venv/lib/python3.9/site-packages/allauth/socialaccount/adapter.py",
line 284, in get_app
apps = self.list_apps(request, provider=provider, client_id=client_id)
File
"/opt/mailman/mm/venv/lib/python3.9/site-packages/allauth/socialaccount/adapter.py",
line 231, in list_apps
db_apps = SocialApp.objects.on_site(request)
File
"/opt/mailman/mm/venv/lib/python3.9/site-packages/allauth/socialaccount/models.py",
line 27, in on_site
site = get_current_site(request)
File
"/opt/mailman/mm/venv/lib/python3.9/site-packages/django/contrib/sites/shortcuts.py",
line 16, in get_current_site
return Site.objects.get_current(request)
File
"/opt/mailman/mm/venv/lib/python3.9/site-packages/django/contrib/sites/models.py",
line 63, in get_current
raise ImproperlyConfigured(
django.core.exceptions.ImproperlyConfigured: You're using the Django
"sites framework" without having set the SITE_ID setting. Create a site
in your database and set the SITE_ID setting or pass a request to
Site.objects.get_current() to fix this error.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan