on master help sign in
[enh] favicon added
commit5c8382c1ba46ddef8d58c01b7517a156b305635c authorasciimoo <asciimoo@gmail.com> dateSun 1 Dec 2013, 23:52 (13 years ago) parent5351104
3 files changed+12−6
searx/static/img/favicon.png searx/templates/base.html+1 searx/webapp.py+11−6
searx/static/img/favicon.pngnew file

Binary file not shown.

searx/templates/base.html+1
@@ -7,6 +7,7 @@
77 <meta name="keywords" content="searx, search, search engine, metasearch, meta search" />
88 <title>{% block title %}{% endblock %}searx</title>
99 <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') }}" />
1011 {% block styles %}
1112 {% endblock %}
1213 {% block head %}
searx/webapp.py+11−6
@@ -17,10 +17,10 @@ along with searx. If not, see < http://www.gnu.org/licenses/ >.
1717(C) 2013- by Adam Tauber, <asciimoo@gmail.com>
1818'''
1919
20+import os
2021if __name__ == "__main__":
2122 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__))+'/../'))
2424
2525from flask import Flask, request, render_template, url_for, Response, make_response
2626from searx.engines import search, categories, engines, get_engines_stats
@@ -28,6 +28,8 @@ from searx import settings
2828import json
2929import cStringIO
3030from searx.utils import UnicodeWriter
31+from flask import send_from_directory
32+
3133
3234
3335app = Flask(__name__)
@@ -133,10 +135,6 @@ def index():
133135
134136 return resp
135137
136−@app.route('/favicon.ico', methods=['GET'])
137−def fav():
138− return ''
139−
140138@app.route('/about', methods=['GET'])
141139def about():
142140 global categories
@@ -172,6 +170,13 @@ def opensearch():
172170 mimetype="application/xml")
173171 return resp
174172
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+
175180if __name__ == "__main__":
176181 from gevent import monkey
177182 monkey.patch_all()