烧瓶404捕获要求的网址 [英] Flask 404 Catch requested url
本文介绍了烧瓶404捕获要求的网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用此功能在网站上捕获404错误:
I'm catching 404 errors on my website with this function:
@app.errorhandler(404)
def page_not_found(e):
logger.warning('User raised an 404: {error}'.format(error=str(e)))
return render_template('404.html'), 404
但是我想知道用户尝试访问以提高404的网址,这是执行此操作的简单方法吗?
But I would like to know wich url the user tried to access to raise the 404, is they a simple way to do this ?
推荐答案
使用request.path
知道哪个URL试图访问并引发404.
Use request.path
to know which url tried to access and raised 404.
这篇关于烧瓶404捕获要求的网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文