from flask import Flask, render_template from flask.ext.bootstrap import Bootstrap app = Flask(__name__) bootstrap = Bootstrap(app) #用Bootstrap模板玩玩 @app.errorhandler(404) def page_not_found(e): return render_template('404.html'), 404
base.html
{% extends "bootstrap/base.html" %} {% block title %}dllhook{% endblock %} {% block navbar %} <div class="navbar navbar-inverse" role="navigation"> <div class="container"> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="/">PiaoYun</a> </div> <div class="navbar-collapse collapse"> <ul class="nav navbar-nav"> <li><a href="/">Home</a></li> </ul> </div> </div> </div> {% endblock %} {% block content %} <div class="container"> {% block page_content %}{% endblock %} </div> {% endblock %}
404.html:
{% extends "base.html" %} {% block title %}dllhook - Page Not Found{% endblock %} {% block page_content %} <div class="page-header"> <h1>页面不存在哦~~~ 赶快到www.dllhook.com玩玩吧 吼吼~</h1> </div> {% endblock %}
发表评论