我想在我的项目中设置Django-allauth.我遇到此错误,无法修复它.
环境:
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')
Run Code Online (Sandbox Code Playgroud)
已安装的中间件:
('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 :
Run Code Online (Sandbox Code Playgroud)
我实际上在Django Admin中配置了一个facebook应用程序,但无法理解为什么它会给出这个异常.
Exception Type: …Run Code Online (Sandbox Code Playgroud) 假设用户在/some_url/django-allauth网站的页面上.点击"登录"后,他们会收到以下网址:
/accounts/login/?next=/some_url/
Run Code Online (Sandbox Code Playgroud)
如果他们已经是注册用户,在登录后,他们会被发送到/some_url/,这很好.
但如果他们没有注册,他们点击"注册",他们会被发送到:
/accounts/signup/?next=/some_url/
Run Code Online (Sandbox Code Playgroud)
假设我想在用户/onboarding/注册后立即向用户发送一些入职体验.
什么是覆盖allauth默认行为的最简单方法,/onboarding/即使next=/some_url/指定了a ,也会将用户发送给用户?
我想使用Django-Allauth,所以我安装如下,它在我的笔记本电脑localhost中完美运行; 但是当我在我的服务器中拉它时,遇到以下错误:
No module named 'allauth.account.context_processors'
Run Code Online (Sandbox Code Playgroud)
我该怎么办?
# Django AllAuth
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'templates')],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
# Already defined Django-related contexts here
# `allauth` needs this from django
'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',
"django.contrib.auth.context_processors.auth",
"django.core.context_processors.debug",
"django.core.context_processors.i18n",
"django.core.context_processors.media",
"django.core.context_processors.static",
"django.core.context_processors.tz",
"django.core.context_processors.request",
"moolak.context_processors.image",
],
},
},
]
AUTHENTICATION_BACKENDS = (
# Needed to login by username in Django admin, regardless of `allauth`
'django.contrib.auth.backends.ModelBackend',
# `allauth` specific authentication methods, such …Run Code Online (Sandbox Code Playgroud) 我有一个django项目,我在其中使用Django-rest-auth进行身份验证.我想使用带密码的电子邮件来验证用户身份,而不是用户名+密码.
我在settings.py中有以下设置,但它对我没有任何作用:
REST_SESSION_LOGIN = True
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
ACCOUNT_EMAIL_REQUIRED = True
ACCOUNT_AUTHENTICATION_METHOD = 'EMAIL'
ACCOUNT_EMAIL_VERIFICATION = 'optional'
Run Code Online (Sandbox Code Playgroud)
我怎样才能实现它?
python django django-rest-framework django-allauth django-rest-auth
我正在使用Django 1.10,我想将allauth的应用程序添加到我的网站登录,登录等.我从pip安装了allauth,并试图将allauth存储库中的模板放在我的模板文件夹中并调用它们,但我不知道如何使其工作.
我正在使用django-allauth进行社交登录的django项目,同时我使用Disqus作为我网站的评论系统.
我想知道,如何使用Disqus与allauth的单点登录功能?
背景
我正在构建一个应用程序,用户可以邀请其他人在不同的资源上进行协作.被邀请的人可能已经是该应用的用户,或者可能是全新的用户.由于我正在使用allauth进行注册/签名,被邀请者可以通过标准注册/登录表单或通过三个社交帐户(fb,twitter,google)中的一个来回复邀请.
由于这些要求,如果现有用户接受邀请,则子类化DefaultAccountAdapter和覆盖该is_open_for_signup方法将不起作用,因为这不是登录流程的一部分.
流
逻辑
接受视图的url模式
url(r'^invitation/(?P<invite_key>[\w\d]+)/$', views.ResourceInviteAcceptanceView.as_view(), name='resource-invite-accept'),
Run Code Online (Sandbox Code Playgroud)
这些是我视图的基类
https://gist.github.com/jamesbrobb/748c47f46b9bd224b07f
这是邀请接受视图的视图逻辑
from django.contrib.auth.models import User
from django.shortcuts import get_object_or_404
from django.dispatch import receiver
from allauth.account import app_settings
from allauth.account.forms import LoginForm, SignupForm
from allauth.account.utils import get_next_redirect_url, complete_signup
from allauth.account.signals import user_signed_up, user_logged_in
from forms.views import MultiFormsView
from api.models import ResourceInvite
class ResourceInviteAcceptanceView(MultiFormsView):
template_name = 'public/resource_invite_accept.html'
form_classes = {'login': LoginForm,
'signup': SignupForm}
redirect_field_name = "next"
def get_invite(self): …Run Code Online (Sandbox Code Playgroud) 在使用allauth登录时,如何使用django-rest-framework-jwt生成令牌并将其传递给可以将令牌存储在localstorage中的模板?
我知道django-rest-framework-jwt允许你通过POST生成令牌:
$ curl -X POST -d "username=admin&password=abc123" http://localhost:8000/api-token-auth/
Run Code Online (Sandbox Code Playgroud)
但是你如何在allauth的登录/注册流程中实现这一点?
我使用Django和Django REST框架作为后端,AngularJS作为前端.
对于用户管理,我使用的是django-rest-auth,它使用django-allauth进行用户管理.作为基础,我使用了django-rest-auth的demo.
问题出在注册后,当您尝试验证通过激活网址发送电子邮件的电子邮件时: 127.0.0.1:8000/account/confirm-email/yhca8kmijle0ia7k3p7ztbvnd2n1xepn9kyeuaycmlzll5xw19ubjarnvjrot7eu/
其中*127.0.0.1:8000是Django后端.
但在我的情况下,它应该发送类似的URL localhost:9000/#/verifyEmail/akv2dcvrfnk9ex5fho9jk0xx1ggtpfazmi8sfsoi2sbscoezywfp7kzcyqnizrc0.所以这个验证将从前端完成,localhost:9000我的AngularJS前端在哪里.
有没有办法在django-allauth上定制activate_url?
django django-urls angularjs django-rest-framework django-allauth
我使用django-oauth-toolkit构建了一个oauth提供程序.
我现在想允许我的客户端应用程序的用户通过此提供程序登录.
我的理解是,django-allauth是理想的工具.
我看到django-allauth为每个提供程序都有一个特殊的文件夹,在这个文件夹中有一个名为的特殊文件provider.py.例如,这是github提供程序的文件夹.
我应该创建类似于此文件夹的内容,特别是我的自定义提供程序吗?或者有更简单/更好的方法吗?
django ×10
django-allauth ×10
python ×5
angularjs ×1
disqus ×1
django-urls ×1
facebook ×1
jwt ×1
oauth ×1
packages ×1