Wagtail:如何更改默认根和/或主页

Tin*_*nce 6 wagtail

如何在我的站点的根级别创建自定义主页?

我正在将 wagtail 集成到我的 django 项目中。正如所记录的,我尝试插入我的自定义主页模型并创建一个新的站点记录

...您可能希望将其替换为您自己的 HomePage 类 - 当您这样做时,请确保您设置了一个站点记录(在 Wagtail 管理中的“设置”/“站点”下)以指向新的主页。

当我尝试更新我网站的根设置时,页面资源管理器没有列出我的自定义主页。而且我无法在根级别从我的模型创建页面。当我删除现有的根页面时,我完全被卡住了。

任何指导将不胜感激。谢谢。

更新(已解决)

考虑到我的自定义主页将成为我这边的根,我parent_page_types = []在我的模型中进行了此设置。删除它可以让我将它作为子项添加到现有的根目录中,我可以将它作为根目录指向我的站点。

LB *_*ton 1

Note: This was answered in the question via an update, pasting below for future readers.

On the page model, setting parent_page_types = [] meant that this page could not be put under other pages. As the root page is also a page, it meant the home page could not be set correctly.

Removing it lets you it as child to existing root, which I can point in my site as the root.

文档 - Page.parent_page_types