Python 重写django模板将引发TemplateSyntaxError
我试图通过在Python 重写django模板将引发TemplateSyntaxError,python,django,python-3.x,Python,Django,Python 3.x,我试图通过在模板/registration/password\u reset\u email.html中添加此文件来重置django应用程序中的password\u reset\u email.html模板: {% load i18n %}{% autoescape off %} {% blocktranslate %}You're receiving this email because you requested a password reset for your user account.
模板/registration/password\u reset\u email.html
中添加此文件来重置django应用程序中的password\u reset\u email.html模板:
{% load i18n %}{% autoescape off %}
{% blocktranslate %}You're receiving this email because you requested a password reset for your user account.{% endblocktranslate %}
{% translate "Please go to the following page and choose a new password:" %}
{% block reset_link %}
{{ protocol }}://{{ domain }}{% url 'password_reset_confirm' uidb64=uid token=token %}
{% endblock %}
{% translate 'Your username, in case you’ve forgotten:' %} {{ user.get_username }}
{% translate "Thanks for using our app!" %}
{% blocktranslate %}The team{% endblocktranslate %}
{% endautoescape %}
但是,它会引发TemplateSyntaxError:
“blocktranslate”,应为“endautoescape”。你忘记登记了吗
还是加载这个标签
我做错了什么?您使用的是哪个版本的Django?首先,可以删除
autoescape
和endautoescape
。他们不希望任何标签在他们之间,这就是为什么我问你使用的是什么版本。没有blocktranslate
标记-它的名称为blocktrans
{%translate%}
应该是{%translate%}
aha,看起来我从分支复制的代码不受2.2支持。