如何自定义Django的默认电子邮件模板?
urls.py
path('change-password/', views.change_password, name='change-password'),
path('reset-password/', PasswordResetView.as_view(template_name='accounts/reset_password.html'),
name='reset-password'),
path('reset-password/done/', PasswordResetDoneView.as_view(), name='password_reset_done'),
path('reset-password/confirm/<uidb64>/<token>/',
PasswordResetConfirmView.as_view(), name='password_reset_confirm'),
path('reset-password/complete/', PasswordResetCompleteView.as_view(), name='password_reset_complete'),我希望自定义django电子邮件模板,并将其作为template_name或类似的文件放在上面的正确路径中?任何帮助都将不胜感激。
谢谢
发布于 2019-05-27 19:58:08
要更改电子邮件默认模板,您需要:
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'templates')],
'APP_DIRS': True,
...
},
]所以目录和结构应该是app_dir/templates/registration/password_reset_email.html.
https://stackoverflow.com/questions/56325496
复制相似问题