Browse Source

add custom 404 page

Noemi Vanyi 8 years ago
parent
commit
0056c4035e

+ 7
- 0
searx/templates/courgette/404.html View File

1
+{% extends "courgette/base.html" %}
2
+{% block content %}
3
+<div class="center">
4
+    <h1>{{ _('Page not found') }}</h1>
5
+    <p>{{ _('Go to <a href="/">search page</a>.') }}</p>
6
+</div>
7
+{% endblock %}

+ 7
- 0
searx/templates/default/404.html View File

1
+{% extends "default/base.html" %}
2
+{% block content %}
3
+<div class="center">
4
+    <h1>{{ _('Page not found') }}</h1>
5
+    <p>{{ _('Go to <a href="/">search page</a>.') }}</p>
6
+</div>
7
+{% endblock %}

+ 7
- 0
searx/templates/oscar/404.html View File

1
+{% extends "oscar/base.html" %}
2
+{% block content %}
3
+<div class="text-center">
4
+    <h1>{{ _('Page not found') }}</h1>
5
+    <p>{{ _('Go to <a href="/">search page</a>.') }}</p>
6
+</div>
7
+{% endblock %}

+ 7
- 0
searx/templates/pix-art/404.html View File

1
+{% extends "pix-art/base.html" %}
2
+{% block content %}
3
+<div class="center">
4
+    <h1>{{ _('Page not found') }}</h1>
5
+    <p>{{ _('Go to <a href="/">search page</a>.') }}</p>
6
+</div>
7
+{% endblock %}

+ 5
- 0
searx/webapp.py View File

715
                     'default_theme': settings['ui']['default_theme']})
715
                     'default_theme': settings['ui']['default_theme']})
716
 
716
 
717
 
717
 
718
+@app.errorhandler(404)
719
+def page_not_found(e):
720
+    return render('404.html')
721
+
722
+
718
 def run():
723
 def run():
719
     app.run(
724
     app.run(
720
         debug=settings['general']['debug'],
725
         debug=settings['general']['debug'],

+ 5
- 0
tests/robot/test_basic.robot View File

9
     Page Should Contain  about
9
     Page Should Contain  about
10
     Page Should Contain  preferences
10
     Page Should Contain  preferences
11
 
11
 
12
+404 page
13
+    Go To  http://localhost:11111/no-such-page
14
+    Page Should Contain  Page not found
15
+    Page Should Contain  Go to search page
16
+
12
 About page
17
 About page
13
     Click Element  link=about
18
     Click Element  link=about
14
     Page Should Contain  Why use Searx?
19
     Page Should Contain  Why use Searx?