Django-allauth没有配置Facebook应用程序:请使用Django管理员添加一个SocialApp [英] Django-allauth No Facebook app configured: please add a SocialApp using the Django admin

查看:221
本文介绍了Django-allauth没有配置Facebook应用程序:请使用Django管理员添加一个SocialApp的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在我的项目中设置 Django-allauth 。我遇到这个错误,无法解决它。



环境:

  :GET请求URL:http:// localhost:8000 / accounts / login /`

Django版本:1.4.2 Python版本:2.7.3
安装的应用程序:
('django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
' ,
$ b'allauth',
'allauth.account',
' allauth.socialaccount',
'allauth.socialaccount.providers.facebook',
'allauth.socialaccount.providers.twitter',
'django.contrib.admin',
'安装的中间件:

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


模板错误:在模板
/media/Dump/Sites/wtr/allauth/templates/socialaccount/snippets/login_extra.html中,
错误在第3行没有Facebook应用配置:请添加一个SocialApp
使用Django admin

1:{%load socialaccount%}
2:
3:{%providers_media_js%}
4:
5:
/ b

$ b

我实际上是在Django管理员中配置了一个Facebook应用程序,但不明白为什么会提供这个例外。

 异常类型:/ accounts / login /异常
不正确配置值:没有配置Facebook应用程序:请使用$ b添加一个SocialApp $ b Django admin




  • 我将allauth应用添加到 INSTALLED_APPLICATIONS

  • 添加 TEMPLATE_CONTEXT_PROCESSORS 设置

  • 修改设置, AUTHENTICATION_BACKENDS

  • 中添加 allauth urls urls.py



这一切是需要做的还是还有一些?如果是的话,请点击我的相关文档?

解决方案

问题可能在于您的数据库。认为您需要同步数据库。



DO



  python manage .py syncdb 

如果不起作用,请确保网站如果您使用localhost或$ code> 127.0.0.1:8000 ,则将您的Facebook应用程序添加到域名为 localhost:8000 code>如果您使用127.0.0.1:8000



有关更多信息,请访问 allauth教程



更新



您还可以尝试从管理员中删除 example.com 网站,并添加一个使用 localhost:8000 127.0.0.1:8000 并在新网站下添加Facebook社交应用。另外,不要忘记在 settings.py 文件中设置 SITE_ID 变量。


I am trying to setup Django-allauth in my project. I am running into this error and am unable to fix it.

Environment:

Request Method: GET Request URL: `http://localhost:8000/accounts/login/`

Django Version: 1.4.2 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',  
'core', 
'allauth',  
'allauth.account',  
'allauth.socialaccount', 
'allauth.socialaccount.providers.facebook', 
'allauth.socialaccount.providers.twitter',  
'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')


Template error: In template
/media/Dump/Sites/wtr/allauth/templates/socialaccount/snippets/login_extra.html,
error at line 3    No Facebook app configured: please add a SocialApp
using the Django admin    

       1 : {% load socialaccount %}
       2 : 
       3 :  {% providers_media_js %} 
       4 : 
       5 :

I actually configured a facebook app in Django Admin but can't understand why it's giving this exception.

 Exception Type: ImproperlyConfigured at /accounts/login/ Exception
 Value: No Facebook app configured: please add a SocialApp using the
 Django admin

  • I added allauth apps to the INSTALLED_APPLICATIONS
  • Added that TEMPLATE_CONTEXT_PROCESSORS setting
  • Edited the setting, AUTHENTICATION_BACKENDS
  • Added allauth urls in urls.py

Is this all that is required to be done or is there some more? If yes, could you please point me to the relevant docs?

解决方案

The problem could be with your database. Think you need to synchronize the Database.

DO

python manage.py syncdb

if that does not work, make sure the Site which you added your facebook app to has the domain localhost:8000 if you are using localhost or 127.0.0.1:8000 if you are using 127.0.0.1:8000

For more information go through this allauth tutorial.

UPDATE

you could also try removing the example.com site from the admin and add a new site that uses localhost:8000 or 127.0.0.1:8000 and add the facebook social app under the new site. Also, do not forget to set the SITE_ID variable in your settings.py file.

这篇关于Django-allauth没有配置Facebook应用程序:请使用Django管理员添加一个SocialApp的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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