django-allauth facebook整合不起作用

时间:2014-06-02 21:28:11

标签: django django-allauth

我收到以下错误。

使用参数'()'和找不到关键字参数'{}'来反转'facebook_channel'。尝试了0种模式:[]

以下行为红色。

{% providers_media_js %} 

这些是来自local_settings.py

的设置
SOCIALACCOUNT_PROVIDERS = \
{'facebook':
    {'SCOPE': ['email', 'publish_stream'],
     'AUTH_PARAMS': {'auth_type': 'reauthenticate'},
     'METHOD': 'js_sdk',
     'LOCALE_FUNC': lambda request: 'en_GB',
     'VERIFIED_EMAIL': False}}

SOCIALACCOUNT_QUERY_EMAIL = True

settings.py

SITE_ID = 1

AUTHENTICATION_BACKENDS = (
'django.contrib.auth.backends.ModelBackend',
# `allauth` specific authentication methods, such as login by e-mail
'allauth.account.auth_backends.AuthenticationBackend',
)


TEMPLATE_CONTEXT_PROCESSORS = (
'django.contrib.auth.context_processors.auth',
'django.core.context_processors.request',
# allauth specific context processors
'allauth.account.context_processors.account',
'allauth.socialaccount.context_processors.socialaccount',
)

THIRD_PARTY_APPS = (
'allauth',
'allauth.account',
'allauth.socialaccount',
'allauth.socialaccount.providers.facebook',
'suit',
'debug_toolbar',
'south',
'crispy_forms',
'haystack',
'taggit',
'bootstrapform',
'sorl.thumbnail',
)

是的,我已完成模型迁移,我有allauth创建的四个表。

任何帮助都会非常感激,这一直困扰着我。

更新

主要urls.py

from django.conf.urls.static import static
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.conf import settings

admin.autodiscover()

urlpatterns = patterns('',
                   url(r'^admin/', include(admin.site.urls)),
                   url(r'^accounts/', include('useraccount.urls')),
                   url(r'^directory/', include('directory.urls')),
                   ) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

urlpatterns += staticfiles_urlpatterns()
urlpatterns += url(r'', 'directory.views.home', name='home'),

if settings.DEBUG:
import debug_toolbar

urlpatterns += patterns('',
                        url(r'^__debug__/', include(debug_toolbar.urls)),
                        )

更新

在useraccount app中的urls.py

from django.conf.urls import patterns, url, include
from django.contrib.auth.decorators import login_required, permission_required
from useraccount.views import AccountView, ProfileUpdateView, ProfileDetailView


urlpatterns = patterns('',
                   (r'^logout', 'django.contrib.auth.views.logout', {'next_page': 'directory_home'}),
                   url(r'^profile/(?P<pk>\w+)', ProfileDetailView.as_view(), name='useraccount_profile'),
                   url(r'^edit', login_required(ProfileUpdateView.as_view()), name='useraccount_edit'),
                   url(r'^dashboard', login_required(AccountView.as_view()), name='useraccount_dashboard'),
                   url(r'', include('allauth.account.urls')),
                   )

1 个答案:

答案 0 :(得分:1)

您需要在网址中包含正确的allauth网址

url(r'', include('allauth.urls'))