diff --git a/lantern/main.py b/lantern/main.py index 1561b07..c17dff8 100644 --- a/lantern/main.py +++ b/lantern/main.py @@ -1,5 +1,6 @@ from sanic import Sanic -from sanic.response import json +from sanic.response import json, text +from sanic.exceptions import NotFound app = Sanic() @@ -8,5 +9,10 @@ async def test(request): return json({"hello": "world"}) +@app.exception(NotFound) +def ignore_404s(request, exception): + return text("Page not found at {}".format(request.url), status=404) + + def main(): app.run(host="0.0.0.0", port="8000")