Python 使夹层主页可编辑

Python 使夹层主页可编辑,python,django,mezzanine,Python,Django,Mezzanine,在URL.py中,有一个如何制作可通过管理员编辑的主页的方法: # HOMEPAGE AS AN EDITABLE PAGE IN THE PAGE TREE # --------------------------------------------- # This pattern gives us a normal ``Page`` object, so that your # homepage can be managed via the page tree in the admin. I

在URL.py中,有一个如何制作可通过管理员编辑的主页的方法:

# HOMEPAGE AS AN EDITABLE PAGE IN THE PAGE TREE
# ---------------------------------------------
# This pattern gives us a normal ``Page`` object, so that your
# homepage can be managed via the page tree in the admin. If you
# use this pattern, you'll need to create a page in the page tree,
# and specify its URL (in the Meta Data section) as "/", which
# is the value used below in the ``{"slug": "/"}`` part.
# Also note that the normal rule of adding a custom
# template per page with the template name using the page's slug
# doesn't apply here, since we can't have a template called
# "/.html" - so for this case, the template "pages/index.html"
# should be used if you want to customize the homepage's template.

url("^$", "mezzanine.pages.views.page", {"slug": "/"}, name="home"),
所以

1) 我在admin中创建了一个名为“home”的页面,在元数据部分使用url“/”

2) 我在我的站点的url.py中取消注释
url(“^$”,“mezzanine.pages.views.page”,{“slug”:“/”},name=“home”),

在这之后,我得到了一个夹层风格的页面,上面有“错误”,没有具体的信息


如何修复此问题?

我首先犯了一些错误-可能是我将页面命名为admin错误

然后在某一点上,我将补丁从复制粘贴到夹层自己的文件(usr/local/lib/python2.7/dist-packages/mezzanine/…)

当我这么做的时候,我的vim配置文件并没有用1个标签代替4个空格。这让我付出了3小时的痛苦)

在我处理夹层的地方(usr/local/lib/python2.7/dist-packages/mezzanine/pages/views.py),我用空格替换了标签,一切都很顺利

因此:

1) 按照url.py的方法操作

2) 在管理员“主页”中命名可编辑主页(我还将其命名为RichTextPage-不知道其他类型是否有效)

3) 具有正确的.vimrc配置文件

4) 修补夹层代码和应用补丁时要小心


我当前的.vimrc-vim配置文件->

我建议您重新开始,不要修改usr/local/lib/python2.7/dist-packages/mezzanine/中的代码。它将产生不希望的结果,并且还会破坏将来的更新

取消对URL中的行的注释

在meta部分中创建url为/的任何页面

也请阅读以下内容:

thx,完成所有这些。也许某个时候需要重新安装mezz,但现在是开发人员部署,所以我修改了。