创建Mezzanine博客主页模板的本地版本

时间:2014-02-05 04:05:20

标签: django mezzanine

我是Django的新手,我正在使用Mezzanine来创建一个基本的博客网站。我想要实现的一件事是使用提供的blog_post_list模板作为主页的基础。在Mezzanine文档中,它解释了如何执行此操作,但是,我想对此模板进行更改。因此,我按照创建夹层博客主页模板的本地副本和编辑urls.py中的urlpatterns以指向文件的本地副本的说明进行操作。但是,当我尝试在浏览器中呈现此主页时,会发生以下错误:

在第145行的模板呈现期间(blog_post_list.html的本地副本)出错: {%pagination_for blog_posts%}

供参考,以下是有问题的html文件:https://github.com/stephenmcd/mezzanine/blob/master/mezzanine/blog/templates/blog/blog_post_list.html

页面已经从Mezzanines核心复制并未经编辑,那么为什么在Mezzanine的核心中打开它时会有效,而不是在我的本地项目目录中?

1 个答案:

答案 0 :(得分:0)

在urls.py中,

url("^$", direct_to_template, {"template": "blog/blog_post_list.html"}, name="home"),

应该是

url("^$", blog_post_list, name="home"),

from mezzanine.blog.views import blog_post_list
相关问题