diff --git a/run.py b/run.py index 5d942b0..2335d54 100644 --- a/run.py +++ b/run.py @@ -5,22 +5,24 @@ app = Flask(__name__) app.secret_key = 'some_secret' + @app.route('/') def index(): return render_template("index.html") - + @app.route('/git') def git(): return render_template("git.html", page_title="Git Profile") - + + @app.route('/contact') def contact(): if request.method == "POST": flash("Thanks {}, we have received your message!".format( request.form["name"])) - return render_template("contact.html", page_title="Contact") + return render_template("contact.html", page_title="Contact") @app.route('/work') @@ -28,49 +30,54 @@ def work(): data = [] with open("data/work.json", "r") as json_data: data = json.load(json_data) - return render_template("work.html", page_title="Experience", work_data = data) + return render_template("work.html", page_title="Experience", + work_data=data) + @app.route('/work/') def about_experience(experience_name): experience = {} - return render_template("work.html", experience = experience) + return render_template("work.html", experience=experience) + @app.route('/education') def education(): data = [] - with open("data/school.json", "r") as json_data: + with open("data/school.json", "r") as json_data: data = json.load(json_data) - - return render_template("education.html", page_title="Education", school_data = data) + + return render_template("education.html", page_title="Education", + school_data=data) + @app.route('/education/') def about_education(education_name): education = {} - - return render_template("education.html", education = education) -#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# -# Page not found 404 Views # -#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# + return render_template("education.html", education=education) + + +# Page not found 404 Views + @app.errorhandler(404) -def not_found(error): +def page_not_found(error): """ - Inbuilt function which takes error as parameter + Inbuilt function which takes error as parameter """ return render_template("404.html"), 404 -#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# -# Internal Error Views # -#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# + +# Internal Error Views + @app.errorhandler(500) -def internal_error(error): +def special_exception_handler(error): """ Inbuilt function which takes error as parameter """ - return render_template("500.html") + return render_template("500.html"), 500 if __name__ == '__main__': app.run(host=os.getenv('IP'), diff --git a/templates/404.html b/templates/404.html index 79fdfbd..97fc5f6 100644 --- a/templates/404.html +++ b/templates/404.html @@ -6,7 +6,7 @@
- 404 page not found + 404 page not found

What you were looking for is just not there...

diff --git a/templates/500.html b/templates/500.html index 85d2bb4..c4786b4 100644 --- a/templates/500.html +++ b/templates/500.html @@ -6,7 +6,7 @@
- 500 server error + 500 server error

It looks like there has been a server error...