diff --git a/nyaa/routes.py b/nyaa/routes.py index 45a34b7..83cbb63 100644 --- a/nyaa/routes.py +++ b/nyaa/routes.py @@ -19,11 +19,6 @@ def category_name(cat_id): return ' - '.join(get_category_id_map().get(cat_id, ['???'])) -@app.errorhandler(404) -def not_found(error): - return flask.render_template('404.html'), 404 - - @cached_function def get_category_id_map(): ''' Reads database for categories and turns them into a dict with diff --git a/nyaa/views/main.py b/nyaa/views/main.py index 86f328d..a361826 100644 --- a/nyaa/views/main.py +++ b/nyaa/views/main.py @@ -14,6 +14,11 @@ from nyaa.views.account import logout bp = flask.Blueprint('main', __name__) +@bp.app_errorhandler(404) +def not_found(error): + return flask.render_template('404.html'), 404 + + @bp.before_app_request def before_request(): flask.g.user = None