我刚刚在我的 django 课程项目中使用 pip 安装了 django-allauth。当我尝试访问“http://127.0.0.1:8000/account/login/”或“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
我正在运行的相关版本: Python 3.11.0 姜戈==4.1.7 django-allauth==0.53.0
我没有修改任何授权文件;只有具有标准配置的基本 settings.py 可在之前的课程项目中使用。 删除该行不起作用。 我尝试将“django.template.context_processors.i18n”添加到settings.py TEMPLATES,我还尝试将“django.middleware.locale.LocaleMiddleware”添加到中间件。没有运气。
你需要使用旧版本的Django:
pipenv install django==3.1.0
pipenv install django-allauth==0.43.0