"django-rest-auth" DoesNotExist: 网站匹配查询不存在

"django-rest-auth" DoesNotExist: Site matching query does not exist

我正在使用 django-rest-auth for facebook integration with android as front-end. I followed all the steps mentioned in integrating django-rest-auth

我只有一个站点并将SITE_ID设置为1

我还设置了我的应用程序的客户端 ID 和秘密 ID,并确保我选择了我的站点。

这是截图

下面是我的代码

 INSTALLED_APPS = [
    'rest_auth',
    'django.contrib.sites',
    'allauth',
    'allauth.account',
    'allauth.socialaccount',
    'allauth.socialaccount.providers.facebook',
]

我的自定义登录序列化程序

REST_AUTH_SERIALIZERS = {
    'LOGIN_SERIALIZER': 'cut_veggie_user.serializers.NormalUserSerializer',
}

AUTHENTICATION_BACKENDS = (
    'django.contrib.auth.backends.ModelBackend',
    'allauth.account.auth_backends.AuthenticationBackend',
)

SITE_ID = 1

在网址中我还包含了 FacebookLogin

urlpatterns = [
              url(r'^rest-auth/facebook/$', FacebookLogin.as_view(),       name='fb_login'),
          ] 

谁能告诉我我错过了什么?

终于找到问题了

我遵循了以下步骤

python manage.py shell

然后我通过这个命令得到了我网站的站点 ID

from django.contrib.sites.models import Site
new_site = Site.objects.create(domain='foo.com', name='foo.com')
print new_site.id

并在 settings.py

中将 ID 添加到 SITE_ID

令我惊讶的是,我得到的站点 ID 为 3,我不确定为什么。

感谢thispost