raise self.model.DoesNotExist( django.contrib.sites.models.Site.DoesNotExist: Site matching query does not exist

  Kiến thức lập trình

I am implementing google authentication in my website but whenever I run my code I got this error.

Internal Server Error: /
Traceback (most recent call last):
  File "C:UsersrahulAppDataLocalProgramsPythonPython312Libsite-packagesdjangocorehandlersexception.py", line 55, in inner
    response = get_response(request)
               ^^^^^^^^^^^^^^^^^^^^^
  File "C:UsersrahulAppDataLocalProgramsPythonPython312Libsite-packagesdjangocorehandlersbase.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:UsersrahulDocumentstournament-webXorivaloginpageviews.py", line 6, in home
    return render(request, "home.html")
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:UsersrahulAppDataLocalProgramsPythonPython312Libsite-packagesdjangoshortcuts.py", line 25, in render
    content = loader.render_to_string(template_name, context, request, using=using)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:UsersrahulAppDataLocalProgramsPythonPython312Libsite-packagesdjangotemplateloader.py", line 62, in render_to_string
    return template.render(context, request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:UsersrahulAppDataLocalProgramsPythonPython312Libsite-packagesdjangotemplatebackendsdjango.py", line 107, in render
    return self.template.render(context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:UsersrahulAppDataLocalProgramsPythonPython312Libsite-packagesdjangotemplatebase.py", line 171, in render
    return self._render(context)
           ^^^^^^^^^^^^^^^^^^^^^
  File "C:UsersrahulAppDataLocalProgramsPythonPython312Libsite-packagesdjangotemplatebase.py", line 163, in _render
    return self.nodelist.render(context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:UsersrahulAppDataLocalProgramsPythonPython312Libsite-packagesdjangotemplatebase.py", line 1008, in render
    return SafeString("".join([node.render_annotated(context) for node in self]))
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:UsersrahulAppDataLocalProgramsPythonPython312Libsite-packagesdjangotemplatebase.py", line 969, in render_annotated
    return self.render(context)
           ^^^^^^^^^^^^^^^^^^^^
  File "C:UsersrahulAppDataLocalProgramsPythonPython312Libsite-packagesdjangotemplatelibrary.py", line 237, in render
    output = self.func(*resolved_args, **resolved_kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:UsersrahulAppDataLocalProgramsPythonPython312Libsite-packagesallauthsocialaccounttemplatetagssocialaccount.py", line 21, in provider_login_url    
    provider = adapter.get_provider(request, provider)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:UsersrahulAppDataLocalProgramsPythonPython312Libsite-packagesallauthsocialaccountadapter.py", line 214, in get_provider
    app = self.get_app(request, provider=provider, client_id=client_id)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:UsersrahulAppDataLocalProgramsPythonPython312Libsite-packagesallauthsocialaccountadapter.py", line 297, in get_app
    apps = self.list_apps(request, provider=provider, client_id=client_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:UsersrahulAppDataLocalProgramsPythonPython312Libsite-packagesallauthsocialaccountadapter.py", line 242, in list_apps
    db_apps = SocialApp.objects.on_site(request)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:UsersrahulAppDataLocalProgramsPythonPython312Libsite-packagesallauthsocialaccountmodels.py", line 34, in on_site
    site = get_current_site(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:UsersrahulAppDataLocalProgramsPythonPython312Libsite-packagesdjangocontribsitesshortcuts.py", line 16, in get_current_site
    return Site.objects.get_current(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:UsersrahulAppDataLocalProgramsPythonPython312Libsite-packagesdjangocontribsitesmodels.py", line 59, in get_current
    return self._get_site_by_id(site_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:UsersrahulAppDataLocalProgramsPythonPython312Libsite-packagesdjangocontribsitesmodels.py", line 30, in _get_site_by_id
    site = self.get(pk=site_id)
           ^^^^^^^^^^^^^^^^^^^^
  File "C:UsersrahulAppDataLocalProgramsPythonPython312Libsite-packagesdjangodbmodelsmanager.py", line 87, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:UsersrahulAppDataLocalProgramsPythonPython312Libsite-packagesdjangodbmodelsquery.py", line 649, in get
    raise self.model.DoesNotExist(
django.contrib.sites.models.Site.DoesNotExist: Site matching query does not exist.
[04/Sep/2024 21:56:26] "GET / HTTP/1.1" 500 145886

I am trying to use google authentication. At first I got the 404 page not found but it was my mistake but I don’t know how to tackle this.
#ignore
this site saying to some more details but I don’t know what to add more just typing randomly.

2

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website Kho Theme wordpress Kho Theme WP Theme WP

LEAVE A COMMENT