Skip to content

Commit

Permalink
fix #114 Error 404 Handled (#116)
Browse files Browse the repository at this point in the history
* error404 handled

* all changes for 404

* final fix error404

* Basic template for 404

* error changes updated

* error changes updated
  • Loading branch information
Surya1231 authored and theSage21 committed May 16, 2019
1 parent f198cf8 commit f5146b0
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
7 changes: 6 additions & 1 deletion server.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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)
2 changes: 1 addition & 1 deletion views/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
<link rel="stylesheet" href="/static/css/bootstrap.min.css">
<script src="/static/js/jquery.min.js"></script>
<script src="/static/js/bootstrap.min.js"></script>
</head>
</head>
13 changes: 13 additions & 0 deletions views/error.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
% include('base.html', title="PyJudge")
<body >
<div class="d-flex h-100 align-items-center justify-content-center text-center" style="min-height:600px">
<div class="container" >
<h1 class="display-1">{{errorcode}}</h1>
<h4 class="text-muted"> {{errorbody}}</h4>
<div class="text-center">
<a href="/" class='btn btn-outline-primary'>Go To Homepage</a>
</div>
</div>
</div>
</body>
</html>

0 comments on commit f5146b0

Please sign in to comment.