app.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:blog-code-examples 作者: fullstackpython 项目源码 文件源码
def show_page(page):
    try:
        valid_length = len(page) >= MIN_PAGE_NAME_LENGTH
        valid_name = re.match('^[a-z]+$', page.lower()) is not None
        if valid_length and valid_name:
            return render_template("{}.html".format(page))
        else:
            msg = "Sorry, couldn't find page with name {}".format(page)
            raise NotFound(msg)
    except:
        rollbar.report_exc_info()
        return Response("404 Not Found")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号