Django:SocialApp匹配查询不存在 [英] Django: SocialApp matching query does not exist

查看:856
本文介绍了Django:SocialApp匹配查询不存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在django-allauth中遇到问题。

I am facing a problem in django-allauth .

我配置了 localhost:9000 / admin / with以下细节

I configured localhost:9000/admin/ with following details

socialapp。

socialapp .

提供者:
名称:
客户端ID:
应用程序ID或消费者密钥
密钥:
密钥等。

provider: Name: Client id: App ID, or consumer key Key: Secret: etc .

我设置了SITE_ID = 2(因为我更改了默认site example to localhost:9000)

I set the SITE_ID = 2 (Because I changed the default site example.com to localhost:9000)

In setting.py


   INSTALLED_APPS = (
        'django.contrib.auth',
        'django.contrib.contenttypes',
        'django.contrib.sessions',
        'django.contrib.sites',
        'django.contrib.messages',
        'django.contrib.staticfiles',
        'django.contrib.admin',
        'uni_form',
        'allauth',
        'allauth.account',
        'allauth.socialaccount',
        'bootstrapform',
        # 'allauth.socialaccount.providers.twitter',
        # 'allauth.socialaccount.providers.openid',
         'allauth.socialaccount.providers.facebook',
    )
    SOCIALACCOUNT_PROVIDERS = \
        { 'facebook':
            { 'SCOPE': ['email', 'publish_stream'],
              'AUTH_PARAMS': { 'auth_type': 'reauthenticate' },
              'METHOD': 'oauth2' ,
              'LOCALE_FUNC': 'path.to.callable'} }

我在进行url http:// localhost:9000 / accounts / facebook / login

我正在收到错误: SocialApp匹配查询不存在。

请帮助我在这里做错什么。 >

Please help me out what might i am doing wrong here .

推荐答案

使用Django管理员,您需要创建一个 SocialApp 列出您的Facebook应用程序凭据。确保此应用程序附加到正确的站点(如 django.contrib.sites.models.Site )。

Using the Django admin you need to create a SocialApp listing your Facebook app credentials. Make sure that this app is attached to the proper site (as in, django.contrib.sites.models.Site).

在你的情况下,需要一个 django.contrib.sites.models.Site 2(查看网站管理员)被列为 SocialApp 的站点。

In your case, there needs to be a django.contrib.sites.models.Site instance with id=2 (check the sites admin) that is listed as a site for the SocialApp.

如果code> SocialApp 缺少,或者如果创建但未附加到与 settings.SITE_ID 匹配的网站,则$ code> allauth 不知道该选择什么应用程序,导致上面列出的错误消息。

If either the SocialApp is missing, or if it is created but not attached to a site matching your settings.SITE_ID, then allauth does not know what app to pick, resulting in the error message you listed above.

这篇关于Django:SocialApp匹配查询不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆