我正在使用 Mezzanine 并希望覆盖通用的 Django 404 和 500 页面模板。我将错误文件夹复制到:
my_theme/templates/errors
错误中的 404.html 和 500.html 模板应覆盖通用模板,但它们不会...我尝试将这两个文件也直接复制到 /templates 文件夹中,但无法正常工作。
我正在使用 Mezzanine 并希望覆盖通用的 Django 404 和 500 页面模板。我将错误文件夹复制到:
my_theme/templates/errors
错误中的 404.html 和 500.html 模板应覆盖通用模板,但它们不会...我尝试将这两个文件也直接复制到 /templates 文件夹中,但无法正常工作。
您使用的是哪个版本的夹层?在旧版本中,模板路径应该是 my_theme/templates/ 而不是 my_theme/templates/errors/ 。请参阅:https ://groups.google.com/forum/#!topic/mezzanine-users/5N94Q33uwvc
另外,您是否在设置中定义了 DIRS?像这样:
TEMPLATES = [
{
"DIRS": [
os.path.join(PROJECT_ROOT, "templates")
],
...
请参阅:https ://docs.djangoproject.com/en/1.11/topics/templates/#configuration