I'm following the instructions for using django-allauth as shown here. I'm not interested in using social authentication - just a simple email and password signup flow. For some reason, when I go to /accounts/login/
I get the error
TemplateSyntaxError at /accounts/login/
'socialaccount' is not a registered tag library. Must be one of:
account
account_tags
...
In my settings.py
I have
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'
Where did I go wrong?
You need to add allauth.socialaccount
to INSTALLED_APPS
.
More on this can be found in the settings documentation
You need to add allauth.socialaccount to INSTALLED_APPS or override login.html template and not include 'socialaccount' tag.
For anyone with same error in future.
There will be some conditions if you see such error
'socialaccount' is not a registered tag library. Must be one of:
accounts
account_tags
....
{% load socialaccount %}
in template. eg. login.html and not included allauth.socialaccounts
in INSTALLED_APPS
makemigrations
or did not migrate
. you have done makemigrations and migratedin my case i removed all all.auth from settings.py but forget to remove {% load socialaccount %}
from template file..
but solved in time ..
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With