回到顶部

阅读目录

404 页面使用腾讯公益 404

注意:django 404 自定义页面仅 debug = False 才生效

django 404、500 等配置文档:

http://doc.codingdict.com/django/topics/http/views.html#customizing-error-views

主 urls.py 定义 handler404、handler500 使用哪个函数

from blog.views import page_not_found, page_not_found


# 自定义错误页面,不用导入 handler400
# http://doc.codingdict.com/django/topics/http/views.html#customizing-error-views
handler404 = page_not_found
handler500 = page_not_found

views.py 定义 handler404、handler500 函数使用的 html 页面

def page_not_found(request):
    # return render_to_response("404.html")
    return render_to_response("404_qq_pb.html")


def server_error(request):
    return render_to_response("500.html")

腾讯公益 404 HTML 代码:(本地文件运行会显示空白哦,要放到服务器上返回才能正常显示)

<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="description" content="XIEBOKE.NET 的 404"/>
    <meta name="description" content="你访问的页面找不回来了,但是我们可以一起寻找失踪宝贝"/>
    <meta name="description" content="公益404页面是由腾讯公司员工志愿者自主发起的互联网公益活动。">
    <meta name="keywords" content="404,XIEBOKE.NET,404 公益计划,404 错误页面,一起寻找失踪宝贝"/>
    <title>寻找失踪宝贝 - 公益 404</title>
    <style>
        .desc a {
            text-align: left;
            font-weight: bold;
            text-decoration: none;
            color: #10D07A;
            margin-left: 10px;
        }

        .desc a:hover {
            color: #0066cc; /* 超链接色号  #0066cc */
            text-decoration: none;
        }
    </style>
</head>
<body>
<script type="text/javascript" src="//qzonestyle.gtimg.cn/qzone/hybrid/app/404/search_children.js" charset="utf-8"
        homePageUrl="/" homePageName="返回 XIEBOKE.NET 主页"></script>
</body>
</html>

公益 404 效果:

去看看 公益 404


^_^
请喝咖啡 ×

文章部分资料可能来源于网络,如有侵权请告知删除。谢谢!

前一篇: HTML a 标签的几种状态
下一篇: django 提高网页打开速度
captcha