コード例 #1
0
ファイル: app.py プロジェクト: d3npa/universe
def handle_404(error):
    path = universe.root + "/content/.404.txt"
    if not os.path.exists(universe.flatten(path)):
        return error
    res = get_document(".404.txt")
    res.status_code = 404
    return res
コード例 #2
0
def catch_all(path):
    path = universe.flatten(path).split("/")
    # print("[* catch_all] Path: %s" % path)
    if path[0] in ["css", "js"]:
        return get_resource("/".join(path))
    else:
        return get_document("/".join(path))
    abort(404)