forked from zaclys/searxng
[enh] explicit engine init
This commit is contained in:
parent
14f58bdaec
commit
a605377c40
|
@ -32,7 +32,6 @@ engine_dir = dirname(realpath(__file__))
|
||||||
engines = {}
|
engines = {}
|
||||||
|
|
||||||
categories = {'general': []}
|
categories = {'general': []}
|
||||||
_initialized = False
|
|
||||||
|
|
||||||
engine_shortcuts = {}
|
engine_shortcuts = {}
|
||||||
engine_default_args = {'paging': False,
|
engine_default_args = {'paging': False,
|
||||||
|
@ -202,11 +201,10 @@ def get_engines_stats():
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
if 'engines' not in settings or not settings['engines']:
|
def initialize_engines(engine_list):
|
||||||
logger.error('No engines found. Edit your settings.yml')
|
global categories, engines
|
||||||
exit(2)
|
engines = {}
|
||||||
|
categories = {'general': []}
|
||||||
for engine_data in settings['engines']:
|
for engine_data in engine_list:
|
||||||
engine = load_engine(engine_data)
|
engine = load_engine(engine_data)
|
||||||
if engine is not None:
|
|
||||||
engines[engine.name] = engine
|
engines[engine.name] = engine
|
||||||
|
|
|
@ -53,7 +53,7 @@ from flask_babel import Babel, gettext, format_date, format_decimal
|
||||||
from flask.json import jsonify
|
from flask.json import jsonify
|
||||||
from searx import settings, searx_dir, searx_debug
|
from searx import settings, searx_dir, searx_debug
|
||||||
from searx.engines import (
|
from searx.engines import (
|
||||||
categories, engines, get_engines_stats, engine_shortcuts
|
categories, engines, engine_shortcuts, get_engines_stats, initialize_engines
|
||||||
)
|
)
|
||||||
from searx.utils import (
|
from searx.utils import (
|
||||||
UnicodeWriter, highlight_content, html_to_text, get_themes,
|
UnicodeWriter, highlight_content, html_to_text, get_themes,
|
||||||
|
@ -765,6 +765,7 @@ def page_not_found(e):
|
||||||
|
|
||||||
|
|
||||||
def run():
|
def run():
|
||||||
|
initialize_engines(settings['engines'])
|
||||||
app.run(
|
app.run(
|
||||||
debug=searx_debug,
|
debug=searx_debug,
|
||||||
use_debugger=searx_debug,
|
use_debugger=searx_debug,
|
||||||
|
|
Loading…
Reference in New Issue