夹层404和500错误模板不会覆盖

时间:2016-10-15 22:21:32

标签: django error-handling mezzanine custom-error-pages errortemplate

我正在使用Mezzanine并希望覆盖通用的Django 404和500页面模板。我将errors文件夹复制到:

my_theme/templates/errors
错误中的404.html和500.html模板应覆盖通用模板,但它们不会......我试图将这两个文件直接复制到/ templates文件夹中,但无效。

1 个答案:

答案 0 :(得分:0)

您使用的是哪个版本的Mezzanine?在旧版本中,模板路径应为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

相关问题