@@ -56,9 +56,9 @@ from searx.engines import (
56 categories, engines, engine_shortcuts, get_engines_stats, initialize_engines
56 categories, engines, engine_shortcuts, get_engines_stats, initialize_engines
58from searx.utils import (
58from searx.utils import (
59− UnicodeWriter, highlight_content, html_to_text, get_themes,
59+ UnicodeWriter, highlight_content, html_to_text, get_resources_directory,
60− get_static_files, get_result_templates, gen_useragent, dict_subset,
60+ get_static_files, get_result_templates, get_themes, gen_useragent,
61− prettify_url
61+ dict_subset, prettify_url
63from searx.version import VERSION_STRING
63from searx.version import VERSION_STRING
64from searx.languages import language_codes
64from searx.languages import language_codes
@@ -91,17 +91,25 @@ if sys.version_info[0] == 3:
91from werkzeug.serving import WSGIRequestHandler
91from werkzeug.serving import WSGIRequestHandler
92WSGIRequestHandler.protocol_version = "HTTP/{}".format(settings['server'].get('http_protocol_version', '1.0'))
92WSGIRequestHandler.protocol_version = "HTTP/{}".format(settings['server'].get('http_protocol_version', '1.0'))
94−static_path, templates_path, themes =\
94+# about static
95− get_themes(settings['ui']['themes_path']
95+static_path = get_resources_directory(searx_dir, 'static', settings['ui']['static_path'])
96− if settings['ui']['themes_path']
96+logger.debug('static directory is %s', static_path)
97− else searx_dir)
97+static_files = get_static_files(static_path)
99default_theme = settings['ui']['default_theme']
100default_theme = settings['ui']['default_theme']
101+templates_path = get_resources_directory(searx_dir, 'templates', settings['ui']['templates_path'])
102+logger.debug('templates directory is %s', templates_path)
103+themes = get_themes(static_path)
104+result_templates = get_result_templates(templates_path)
106+for indice, theme in enumerate(themes):
107+ global_favicons.append([])
108+ theme_img_path = os.path.join(static_path, 'themes', theme, 'img', 'icons')
109+ for (dirpath, dirnames, filenames) in os.walk(theme_img_path):
110+ global_favicons[indice].extend(filenames)
101−static_files = get_static_files(searx_dir)
112+# Flask app
103−result_templates = get_result_templates(searx_dir)
105app = Flask(
113app = Flask(
106 __name__,
114 __name__,
107 static_folder=static_path,
115 static_folder=static_path,
@@ -120,13 +128,6 @@ babel = Babel(app)
120rtl_locales = ['ar', 'arc', 'bcc', 'bqi', 'ckb', 'dv', 'fa', 'glk', 'he',
128rtl_locales = ['ar', 'arc', 'bcc', 'bqi', 'ckb', 'dv', 'fa', 'glk', 'he',
121 'ku', 'mzn', 'pnb'', ''ps', 'sd', 'ug', 'ur', 'yi']
129 'ku', 'mzn', 'pnb'', ''ps', 'sd', 'ug', 'ur', 'yi']
124−for indice, theme in enumerate(themes):
125− global_favicons.append([])
126− theme_img_path = searx_dir + "/static/themes/" + theme + "/img/icons/"
127− for (dirpath, dirnames, filenames) in os.walk(theme_img_path):
128− global_favicons[indice].extend(filenames)
130# used when translating category names
131# used when translating category names
131_category_names = (gettext('files'),
132_category_names = (gettext('files'),
132 gettext('general'),
133 gettext('general'),