Python Django-Allauth错误:"';社会账户';不是已注册的标记库“;
我按照使用django allauth的说明进行操作,如图所示。我对使用社会认证不感兴趣——只是一个简单的电子邮件和密码注册流程。由于某种原因,当我转到Python Django-Allauth错误:"';社会账户';不是已注册的标记库“;,python,django,django-allauth,Python,Django,Django Allauth,我按照使用django allauth的说明进行操作,如图所示。我对使用社会认证不感兴趣——只是一个简单的电子邮件和密码注册流程。由于某种原因,当我转到/accounts/login/时,我得到了错误 TemplateSyntaxError at /accounts/login/ 'socialaccount' is not a registered tag library. Must be one of: account account_tags ... 在mysettings.py中,我
/accounts/login/
时,我得到了错误
TemplateSyntaxError at /accounts/login/
'socialaccount' is not a registered tag library. Must be one of:
account
account_tags
...
在mysettings.py中,我有
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
# Required by allauth
AUTHENTICATION_BACKENDS = (
# Needed to login by username in Django admin, regardless of `allauth`
'django.contrib.auth.backends.ModelBackend',
# `allauth` specific authentication methods, such as login by e-mail
'allauth.account.auth_backends.AuthenticationBackend',
)
# Application definition
INSTALLED_APPS = [
# My apps
'trinalysis_app.apps.TrinalysisAppConfig',
# Third party apps
'django.contrib.sites', # Django app required for using allauth
'allauth',
'allauth.account',
# Default apps
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]
# Set AUTH_USER_MODEL as my own user model that uses the email address as the username
AUTH_USER_MODEL = 'trinalysis_app.MyUser'
# allauth config params
SITE_ID = 1
LOGIN_REDIRECT_URL = '/'
ACCOUNT_USER_MODEL_USERNAME_FIELD = None
ACCOUNT_EMAIL_REQUIRED = True
ACCOUNT_USERNAME_REQUIRED = False
ACCOUNT_AUTHENTICATION_METHOD = 'email'
我哪里出错了?您需要将allauth.socialaccount
添加到已安装的应用程序中
有关这方面的更多信息,请参见您需要将allauth.socialaccount添加到已安装的应用程序或覆盖login.html模板,并且不包括“socialaccount”标记。适用于将来出现相同错误的任何人
如果您看到这样的错误,将有一些条件
'socialaccount' is not a registered tag library. Must be one of:
accounts
account_tags
....
如果已在模板中导入{%load socialaccount%}
。例如:login.html,未包含allauth.socialaccounts
在已安装的应用程序中
或者您没有进行迁移
或者没有迁移
。您已经完成了makemigrations和migrated
在我的例子中,我从settings.py中删除了all.auth,但忘了从模板文件中删除{%load socialaccount%}
。。
但是及时解决了 github上有一个。坐look@vishes_shell啊,很惊讶我在搜索中没有找到这个。谢谢我想我应该用我自己的模板覆盖默认模板?我认为@karthikr的答案也会解决这个问题。