标签:
自定义错误页面
views.py
@app.errorhandler(404) def internal_error(error): return render_template(‘error.html‘,errorcode = 404, errormsg = ‘page not found‘) @app.errorhandler(500) def internal_error(error): return render_template(‘error.html‘,errorcode = 500, error = ‘server not found‘)
error.html
{% extends ‘base.html‘ %} {% block content %} <div class=‘content-intermediate‘> <h4>Error: {{errorcode}}</h4> <p class="content-font">{{errormsg}}</p> <p class="content-font"><a href="{{url_for(‘index‘)}}">Back</a></p> </div> {% endblock %}
效果:
标签:
原文地址:http://www.cnblogs.com/valentineisme/p/4299614.html