From 7a23e29d8b617cc901661da7e26c168f7d5cf121 Mon Sep 17 00:00:00 2001 From: alice Date: Sat, 18 Sep 2021 00:35:13 +0200 Subject: [PATCH] 404 on page not found (instead of TemplateDoesNotExist) --- ccvpn/views.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/ccvpn/views.py b/ccvpn/views.py index c7a6bdc..16c574c 100644 --- a/ccvpn/views.py +++ b/ccvpn/views.py @@ -88,10 +88,13 @@ def page(request, name): except TemplateDoesNotExist: pass - md_template = select_template([ - basename + '.' + get_language() + '.md', - basename + '.en.md', - ]) + try: + md_template = select_template([ + basename + '.' + get_language() + '.md', + basename + '.en.md', + ]) + except TemplateDoesNotExist: + return HttpResponseNotFound("Page not found") page_source = md_template.render(None, request) page_fm = frontmatter.loads(page_source)