Browse Source

[enh] favicon added

asciimoo 11 years ago
parent
commit
5c8382c1ba
3 changed files with 12 additions and 6 deletions
  1. BIN
      searx/static/img/favicon.png
  2. 1
    0
      searx/templates/base.html
  3. 11
    6
      searx/webapp.py

BIN
searx/static/img/favicon.png View File


+ 1
- 0
searx/templates/base.html View File

7
     <meta name="keywords" content="searx, search, search engine, metasearch, meta search" />
7
     <meta name="keywords" content="searx, search, search engine, metasearch, meta search" />
8
     <title>{% block title %}{% endblock %}searx</title>
8
     <title>{% block title %}{% endblock %}searx</title>
9
     <link rel="stylesheet" href="/static/css/style.css" type="text/css" media="screen" charset="utf-8" />
9
     <link rel="stylesheet" href="/static/css/style.css" type="text/css" media="screen" charset="utf-8" />
10
+    <link rel="shortcut icon" href="{{ url_for('static', filename='img/favicon.png') }}" />
10
     {% block styles %}
11
     {% block styles %}
11
     {% endblock %}
12
     {% endblock %}
12
     {% block head %}
13
     {% block head %}

+ 11
- 6
searx/webapp.py View File

17
 (C) 2013- by Adam Tauber, <asciimoo@gmail.com>
17
 (C) 2013- by Adam Tauber, <asciimoo@gmail.com>
18
 '''
18
 '''
19
 
19
 
20
+import os
20
 if __name__ == "__main__":
21
 if __name__ == "__main__":
21
     from sys import path
22
     from sys import path
22
-    from os.path import realpath, dirname
23
-    path.append(realpath(dirname(realpath(__file__))+'/../'))
23
+    path.append(os.path.realpath(os.path.dirname(os.path.realpath(__file__))+'/../'))
24
 
24
 
25
 from flask import Flask, request, render_template, url_for, Response, make_response
25
 from flask import Flask, request, render_template, url_for, Response, make_response
26
 from searx.engines import search, categories, engines, get_engines_stats
26
 from searx.engines import search, categories, engines, get_engines_stats
28
 import json
28
 import json
29
 import cStringIO
29
 import cStringIO
30
 from searx.utils import UnicodeWriter
30
 from searx.utils import UnicodeWriter
31
+from flask import send_from_directory
32
+
31
 
33
 
32
 
34
 
33
 app = Flask(__name__)
35
 app = Flask(__name__)
133
 
135
 
134
     return resp
136
     return resp
135
 
137
 
136
-@app.route('/favicon.ico', methods=['GET'])
137
-def fav():
138
-    return ''
139
-
140
 @app.route('/about', methods=['GET'])
138
 @app.route('/about', methods=['GET'])
141
 def about():
139
 def about():
142
     global categories
140
     global categories
172
                 mimetype="application/xml")
170
                 mimetype="application/xml")
173
     return resp
171
     return resp
174
 
172
 
173
+@app.route('/favicon.ico')
174
+def favicon():
175
+    print os.path.join(app.root_path, 'static/img'), 'asdf'
176
+    return send_from_directory(os.path.join(app.root_path, 'static/img'),
177
+                               'favicon.png', mimetype='image/vnd.microsoft.icon')
178
+
179
+
175
 if __name__ == "__main__":
180
 if __name__ == "__main__":
176
     from gevent import monkey
181
     from gevent import monkey
177
     monkey.patch_all()
182
     monkey.patch_all()