Search code examples
djangodjango-templatesdjango-allauth

TemplateSyntaxError when accessing default django-allauth login and registration pages


I've just installed django-allauth with pip in my django course project. I am getting an error in browser when I try to access either "http://127.0.0.1:8000/account/login/" or "http://127.0.0.1:8000/account/signup/" :

TemplateSyntaxError at /account/login/
Invalid block tag on line 17: 'trans', expected 'elif', 'else' or 'endif'. Did you forget to register or load this tag?
Request Method: GET
Request URL:    http://127.0.0.1:8000/account/login/
Django Version: 4.1.7
Exception Type: TemplateSyntaxError
Exception Value:    
Invalid block tag on line 17: 'trans', expected 'elif', 'else' or 'endif'. Did you forget to register or load this tag?
Exception Location: C:\FSSD Projects\Play2LearnFinal\Play2LearnFinal\.venv\Lib\site-packages\django\template\base.py, line 558, in invalid_block_tag
Raised during:  allauth.account.views.LoginView
Python Executable:  C:\FSSD Projects\Play2LearnFinal\Play2LearnFinal\.venv\Scripts\python.exe
Python Version: 3.11.0
Python Path:    
['C:\\FSSD Projects\\Play2LearnFinal\\Play2LearnFinal',
 'C:\\Python311\\python311.zip',
 'C:\\Python311\\DLLs',
 'C:\\Python311\\Lib',
 'C:\\Python311',
 'C:\\FSSD Projects\\Play2LearnFinal\\Play2LearnFinal\\.venv',
 'C:\\FSSD '
 'Projects\\Play2LearnFinal\\Play2LearnFinal\\.venv\\Lib\\site-packages']
Server time:    Fri, 17 Mar 2023 13:38:15 -0500

Relevant versions I'm running: Python 3.11.0 Django==4.1.7 django-allauth==0.53.0

I have not modified any of the auth files; only the base settings.py with standard configuration that worked in previous course projects. Deleting the line did not work. I tried adding 'django.template.context_processors.i18n' to settings.py TEMPLATES, I also tried adding 'django.middleware.locale.LocaleMiddleware' to MIDDLEWARE. No luck.


Solution

  • You need to use an old version of Django:

    pipenv install django==3.1.0
    
    pipenv install django-allauth==0.43.0
    

    For more: LearnDjango — Django-allauth Tutorial.