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


+ 1 - 0
searx/templates/base.html

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

+ 11 - 6
searx/webapp.py

@@ -17,10 +17,10 @@ along with searx. If not, see < http://www.gnu.org/licenses/ >.
 (C) 2013- by Adam Tauber, <asciimoo@gmail.com>
 (C) 2013- by Adam Tauber, <asciimoo@gmail.com>
 '''
 '''
 
 
+import os
 if __name__ == "__main__":
 if __name__ == "__main__":
     from sys import path
     from sys import path
-    from os.path import realpath, dirname
-    path.append(realpath(dirname(realpath(__file__))+'/../'))
+    path.append(os.path.realpath(os.path.dirname(os.path.realpath(__file__))+'/../'))
 
 
 from flask import Flask, request, render_template, url_for, Response, make_response
 from flask import Flask, request, render_template, url_for, Response, make_response
 from searx.engines import search, categories, engines, get_engines_stats
 from searx.engines import search, categories, engines, get_engines_stats
@@ -28,6 +28,8 @@ from searx import settings
 import json
 import json
 import cStringIO
 import cStringIO
 from searx.utils import UnicodeWriter
 from searx.utils import UnicodeWriter
+from flask import send_from_directory
+
 
 
 
 
 app = Flask(__name__)
 app = Flask(__name__)
@@ -133,10 +135,6 @@ def index():
 
 
     return resp
     return resp
 
 
-@app.route('/favicon.ico', methods=['GET'])
-def fav():
-    return ''
-
 @app.route('/about', methods=['GET'])
 @app.route('/about', methods=['GET'])
 def about():
 def about():
     global categories
     global categories
@@ -172,6 +170,13 @@ def opensearch():
                 mimetype="application/xml")
                 mimetype="application/xml")
     return resp
     return resp
 
 
+@app.route('/favicon.ico')
+def favicon():
+    print os.path.join(app.root_path, 'static/img'), 'asdf'
+    return send_from_directory(os.path.join(app.root_path, 'static/img'),
+                               'favicon.png', mimetype='image/vnd.microsoft.icon')
+
+
 if __name__ == "__main__":
 if __name__ == "__main__":
     from gevent import monkey
     from gevent import monkey
     monkey.patch_all()
     monkey.patch_all()