소스 검색

add custom 404 page

Noemi Vanyi 8 년 전
부모
커밋
0056c4035e
6개의 변경된 파일38개의 추가작업 그리고 0개의 파일을 삭제
  1. 7
    0
      searx/templates/courgette/404.html
  2. 7
    0
      searx/templates/default/404.html
  3. 7
    0
      searx/templates/oscar/404.html
  4. 7
    0
      searx/templates/pix-art/404.html
  5. 5
    0
      searx/webapp.py
  6. 5
    0
      tests/robot/test_basic.robot

+ 7
- 0
searx/templates/courgette/404.html 파일 보기

@@ -0,0 +1,7 @@
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 파일 보기

@@ -0,0 +1,7 @@
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 파일 보기

@@ -0,0 +1,7 @@
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 파일 보기

@@ -0,0 +1,7 @@
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 파일 보기

@@ -715,6 +715,11 @@ def config():
715 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 723
 def run():
719 724
     app.run(
720 725
         debug=settings['general']['debug'],

+ 5
- 0
tests/robot/test_basic.robot 파일 보기

@@ -9,6 +9,11 @@ Front page
9 9
     Page Should Contain  about
10 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 17
 About page
13 18
     Click Element  link=about
14 19
     Page Should Contain  Why use Searx?