From 0056c4035e80c7899985dcb38d8d4d1570ac514b Mon Sep 17 00:00:00 2001 From: Noemi Vanyi Date: Wed, 24 Aug 2016 19:53:09 +0200 Subject: [PATCH] add custom 404 page --- searx/templates/courgette/404.html | 7 +++++++ searx/templates/default/404.html | 7 +++++++ searx/templates/oscar/404.html | 7 +++++++ searx/templates/pix-art/404.html | 7 +++++++ searx/webapp.py | 5 +++++ tests/robot/test_basic.robot | 5 +++++ 6 files changed, 38 insertions(+) create mode 100644 searx/templates/courgette/404.html create mode 100644 searx/templates/default/404.html create mode 100644 searx/templates/oscar/404.html create mode 100644 searx/templates/pix-art/404.html diff --git a/searx/templates/courgette/404.html b/searx/templates/courgette/404.html new file mode 100644 index 000000000..465039e3a --- /dev/null +++ b/searx/templates/courgette/404.html @@ -0,0 +1,7 @@ +{% extends "courgette/base.html" %} +{% block content %} +
+

{{ _('Page not found') }}

+

{{ _('Go to search page.') }}

+
+{% endblock %} diff --git a/searx/templates/default/404.html b/searx/templates/default/404.html new file mode 100644 index 000000000..18012f2ac --- /dev/null +++ b/searx/templates/default/404.html @@ -0,0 +1,7 @@ +{% extends "default/base.html" %} +{% block content %} +
+

{{ _('Page not found') }}

+

{{ _('Go to search page.') }}

+
+{% endblock %} diff --git a/searx/templates/oscar/404.html b/searx/templates/oscar/404.html new file mode 100644 index 000000000..39836ce0e --- /dev/null +++ b/searx/templates/oscar/404.html @@ -0,0 +1,7 @@ +{% extends "oscar/base.html" %} +{% block content %} +
+

{{ _('Page not found') }}

+

{{ _('Go to search page.') }}

+
+{% endblock %} diff --git a/searx/templates/pix-art/404.html b/searx/templates/pix-art/404.html new file mode 100644 index 000000000..27e89ae02 --- /dev/null +++ b/searx/templates/pix-art/404.html @@ -0,0 +1,7 @@ +{% extends "pix-art/base.html" %} +{% block content %} +
+

{{ _('Page not found') }}

+

{{ _('Go to search page.') }}

+
+{% endblock %} diff --git a/searx/webapp.py b/searx/webapp.py index 460681b35..e118fee2b 100644 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -715,6 +715,11 @@ def config(): 'default_theme': settings['ui']['default_theme']}) +@app.errorhandler(404) +def page_not_found(e): + return render('404.html') + + def run(): app.run( debug=settings['general']['debug'], diff --git a/tests/robot/test_basic.robot b/tests/robot/test_basic.robot index 4a20d0ba2..4f9b8ae05 100644 --- a/tests/robot/test_basic.robot +++ b/tests/robot/test_basic.robot @@ -9,6 +9,11 @@ Front page Page Should Contain about Page Should Contain preferences +404 page + Go To http://localhost:11111/no-such-page + Page Should Contain Page not found + Page Should Contain Go to search page + About page Click Element link=about Page Should Contain Why use Searx?