gpt4 book ai didi

django - 站点匹配查询不存在。查找参数为 {'pk' : 3}

转载 作者:行者123 更新时间:2023-12-04 05:40:15 24 4
gpt4 key购买 nike

Environment:

Request Method: GET
Django Version: 1.5
Python Version: 2.7.3
Installed Applications:
('django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'allauth',
'allauth.account',
'allauth.socialaccount',
'allauth.socialaccount.providers.facebook',
'allauth.socialaccount.providers.google',
'allauth.socialaccount.providers.linkedin',
'django.contrib.admin',
'django.contrib.admindocs')


Installed Middleware:

('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware')


Traceback:

File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response
115. response = callback(request, *callback_args, **callback_kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/views/generic/base.py" in view
68. return self.dispatch(request, *args, **kwargs)
File "/var/www/sampleapp/allauth/account/views.py" in dispatch
41. **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/views/generic/base.py" in dispatch
86. return handler(request, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/views/generic/edit.py" in get
155. return self.render_to_response(self.get_context_data(form=form))
File "/var/www/sampleapp/allauth/account/views.py" in get_context_data
67. "site": Site.objects.get_current(),
File "/usr/local/lib/python2.7/dist-packages/django/contrib/sites/models.py" in get_current
26. current_site = self.get(pk=sid)
File "/usr/local/lib/python2.7/dist-packages/django/d
b/models/manager.py" in get
143. return self.get_query_set().get(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py" in get
401. (self.model._meta.object_name, kwargs))

Exception Type: DoesNotExist at /accounts/login/
Exception Value: Site matching query does not exist. Lookup parameters were {'pk': 3}

我是 Django 的新手,
帮我解决这个问题?

最佳答案

我也遇到了这个问题。我正在通过 PyCharm Django guide .我通过删除我的 sqlite 数据库文件并再次运行 syncdb 解决了这个问题。我不知道为什么它第一次不起作用,但现在它起作用了。

此外,可能值得下载 SQLite Database Browser以便您可以查看 SQLite 数据库的实际结构。对于这个问题,您对 django_site 表感兴趣。在我删除数据库文件并重新运行 syncdb 后,该表中有一行。

关于django - 站点匹配查询不存在。查找参数为 {'pk' : 3},我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15524176/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com