标签:style blog http color sp for div 2014 log
from flask import Flask, abort, redirect, url_for app = Flask(__name__) @app.route(‘/‘) def index(): return redirect(url_for(‘login‘)) @app.route(‘/login‘) def login(): abort(401) print ‘fuck;‘ app.run()
自定义错误
from flask import Flask, abort, redirect, url_for app = Flask(__name__) @app.route(‘/‘) def index(): return redirect(url_for(‘login‘)) @app.route(‘/login‘) def login(): abort(401) print ‘fuck;‘ #这里自定义一个401错误信息 @app.errorhandler(401) def page_not_found(error): return ‘hi‘, 401 app.run()
标签:style blog http color sp for div 2014 log
原文地址:http://www.cnblogs.com/jypwn/p/4111470.html