Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

custom 404 page with JSON request support

  • Loading branch information...
commit 685e8542d723b0d6592409818a606797c6cad1bf 1 parent c07821a
@axitkhurana axitkhurana authored
Showing with 19 additions and 0 deletions.
  1. +11 −0 popcorn/templates/error.html
  2. +8 −0 popcorn/views.py
View
11 popcorn/templates/error.html
@@ -0,0 +1,11 @@
+{% extends 'layout.html' %}
+
+{% block content %}
+{% filter textile %}
+
+h2. {{ error }}
+
+Try going to our "homepage":{{ url_for('index') }}.
+
+{% endfilter %}
+{% endblock %}
View
8 popcorn/views.py
@@ -216,3 +216,11 @@ def download():
def faq():
"""Frequently asked questions"""
pass
+
+
+@app.errorhandler(404)
+@render(template='error.html')
+def not_found(error):
+ """Handle page not found error"""
+ error_msg = "Not Found"
+ return dict(error=error_msg, code=404, request=request.path)
Please sign in to comment.
Something went wrong with that request. Please try again.