From f5146b055a274ad613606bff596e2b6ba5f32b2d Mon Sep 17 00:00:00 2001 From: Suryaprakash Agarwal <42642288+Surya1231@users.noreply.github.com> Date: Thu, 16 May 2019 18:13:06 +0530 Subject: [PATCH] fix #114 Error 404 Handled (#116) * error404 handled * all changes for 404 * final fix error404 * Basic template for 404 * error changes updated * error changes updated --- server.py | 7 ++++++- views/base.html | 2 +- views/error.html | 13 +++++++++++++ 3 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 views/error.html diff --git a/server.py b/server.py index e8fa131..ba31e30 100644 --- a/server.py +++ b/server.py @@ -1,4 +1,4 @@ -from bottle import Bottle, run, template, static_file, request, route, redirect +from bottle import Bottle, run, template, static_file, request, route, redirect,error import os import sys import datetime @@ -182,4 +182,9 @@ def file_upload(code, number): return "Solved! Great Job! " +@app.error(404) +def error404(error): + return template("error.html" ,errorcode=error.status_code , errorbody = error.body) + + run(app, host="localhost", port=8080) diff --git a/views/base.html b/views/base.html index 0416e31..c10f517 100644 --- a/views/base.html +++ b/views/base.html @@ -6,4 +6,4 @@ - \ No newline at end of file + diff --git a/views/error.html b/views/error.html new file mode 100644 index 0000000..324769a --- /dev/null +++ b/views/error.html @@ -0,0 +1,13 @@ +% include('base.html', title="PyJudge") + +
+
+

{{errorcode}}

+

{{errorbody}}

+ +
+
+ +