漂亮的,聪明的,可定制的错误页面摇摇尾巴。
wagtailerrorpages的Python项目详细描述
wagtail错误页
=======
漂亮、智能、可定制的wagtail错误页。它的灵感来自于ListApart在[ThePerfect404]上的一篇文章(http://a list apart.com/article/perfect404)。
![默认404页](screenshots/error404.png)
\已输入URL。如果用户找不到他们要查找的内容,则鼓励他们搜索或访问主页。
它基于javascript中的"document.referer"属性来确定这一点。如果关闭javascript,则会显示一条常规消息。
下面分别是**空引用者**、**外部引用者**、**外部引用者(搜索引擎)**和**内部引用者**的可能消息。
![可能的404条消息列表](screenshots/error404 messages.png)
install
----
>然后将"wagtailerrorpage"添加到已安装的应用程序中。
usage
-
如果模板目录的根目录中没有"404.html"或"500.html",则会自动拉取它们。从这个应用程序中。
请参阅下面的部分("扩展base404模板")以获取完整的参考,或参阅本回购协议中的"404base.html"。
这是设计的;如果出现服务器错误,Wagtail可能无法呈现模板标记,因此最好保持此模板独立和静态。
如果要自定义模板标记,请将此模板复制到应用程序上的"template s/500.html"中,然后直接对其进行编辑。
使用[cookiecutter wagtail](https://github.com/torchbox/cookiecutter wagtail),您可以在调试模式下访问站点上的`/test404'和`/test500'来预览模板。如果没有,您可以[配置您的url.py](https://github.com/torchbox/torchbox/cookiecutter wagattail/blob/23D5DD7D7A7Ba1E442F6C8C5526D211900d50300ef/%7b%7bCookiecutter.repo\u name%7d%7d%7d/%7b%7bCookiecutter.repo\u name%7d%7d%7d%7d/url.py\l23)允许这样做。
如果您只是想要404页面内容的404页面内容,您可以使用您自己的布局
(如果您只想要404页面内容的404页面内容的404页面内容,(信息与海洋)rch box),你可以把它放在任何地方:
{%load wagtailerrorpage}
{%message404%}
模板中的消息如下:
{%包括"wagtailerrorpages/fragments/404message.html",其中搜索结果=我的页面列表%}
>然后使用python进行搜索,并适当地呈现页面列表。
r/>{%扩展了"wagtailerrorpage/404base.html"%}
以下是布局的可重写模板块的引用。
最好在结尾处添加网站名称。
{%block title%}找不到页面-mysite{%endblock%}
默认为下面的广告。
{%block meta%}
<;meta charset="utf-8">;
<;meta http equiv="x-ua-compatible"content="ie=edge">;
<;meta name="viewport"content="width=device width,initial scale=1">;
{%endblock%}
nd extra html head
extra head content;将自定义样式表放在此处。默认情况下,它包含自定义样式表,因此重写此块将删除它。
{%block head%}
<;link rel="stylesheet"ref="{%static"css/404.css"%}">;
{%endblock%}
默认情况下,它包含"回家"链接。您可能希望包含网站的徽标,但请避免包含完整的导航。
{%block header%}
[<;a href="/">;回家<;/a>;]
{%endblock%}
它导入404消息片段。
{%block content%}
{%message404%}
{%endblock%}
您可能需要包含丢失用户的有用链接或法律/版权信息。
{%block footer%}{%endblock%}
=======
漂亮、智能、可定制的wagtail错误页。它的灵感来自于ListApart在[ThePerfect404]上的一篇文章(http://a list apart.com/article/perfect404)。
![默认404页](screenshots/error404.png)
\已输入URL。如果用户找不到他们要查找的内容,则鼓励他们搜索或访问主页。
它基于javascript中的"document.referer"属性来确定这一点。如果关闭javascript,则会显示一条常规消息。
下面分别是**空引用者**、**外部引用者**、**外部引用者(搜索引擎)**和**内部引用者**的可能消息。
![可能的404条消息列表](screenshots/error404 messages.png)
install
----
>然后将"wagtailerrorpage"添加到已安装的应用程序中。
usage
-
如果模板目录的根目录中没有"404.html"或"500.html",则会自动拉取它们。从这个应用程序中。
请参阅下面的部分("扩展base404模板")以获取完整的参考,或参阅本回购协议中的"404base.html"。
这是设计的;如果出现服务器错误,Wagtail可能无法呈现模板标记,因此最好保持此模板独立和静态。
如果要自定义模板标记,请将此模板复制到应用程序上的"template s/500.html"中,然后直接对其进行编辑。
使用[cookiecutter wagtail](https://github.com/torchbox/cookiecutter wagtail),您可以在调试模式下访问站点上的`/test404'和`/test500'来预览模板。如果没有,您可以[配置您的url.py](https://github.com/torchbox/torchbox/cookiecutter wagattail/blob/23D5DD7D7A7Ba1E442F6C8C5526D211900d50300ef/%7b%7bCookiecutter.repo\u name%7d%7d%7d/%7b%7bCookiecutter.repo\u name%7d%7d%7d%7d/url.py\l23)允许这样做。
如果您只是想要404页面内容的404页面内容,您可以使用您自己的布局
(如果您只想要404页面内容的404页面内容的404页面内容,(信息与海洋)rch box),你可以把它放在任何地方:
{%load wagtailerrorpage}
{%message404%}
模板中的消息如下:
{%包括"wagtailerrorpages/fragments/404message.html",其中搜索结果=我的页面列表%}
>然后使用python进行搜索,并适当地呈现页面列表。
r/>{%扩展了"wagtailerrorpage/404base.html"%}
以下是布局的可重写模板块的引用。
最好在结尾处添加网站名称。
{%block title%}找不到页面-mysite{%endblock%}
默认为下面的广告。
{%block meta%}
<;meta charset="utf-8">;
<;meta http equiv="x-ua-compatible"content="ie=edge">;
<;meta name="viewport"content="width=device width,initial scale=1">;
{%endblock%}
nd extra html head
extra head content;将自定义样式表放在此处。默认情况下,它包含自定义样式表,因此重写此块将删除它。
{%block head%}
<;link rel="stylesheet"ref="{%static"css/404.css"%}">;
{%endblock%}
默认情况下,它包含"回家"链接。您可能希望包含网站的徽标,但请避免包含完整的导航。
{%block header%}
[<;a href="/">;回家<;/a>;]
{%endblock%}
它导入404消息片段。
{%block content%}
{%message404%}
{%endblock%}
您可能需要包含丢失用户的有用链接或法律/版权信息。
{%block footer%}{%endblock%}