mirror of
https://github.com/searxng/searxng.git
synced 2025-07-24 13:49:26 +02:00
[mod] webapp.py: update engines initialization condition
Always call initialize engines except on the first run of werkzeug with the reload feature. the reload feature is activated when: * searx_debug is True (SEARX_DEBUG environment variable or settings.yml) * FLASK_APP=searx/webapp.py FLASK_ENV=development flask run (see https://flask.palletsprojects.com/en/1.1.x/cli/ ) Fix SEARX_DEBUG=0 make docs docs/admin/engines.rst : engines are initialized See https://github.com/searx/searx/issues/2204#issuecomment-701373438
This commit is contained in:
parent
2cafc5462d
commit
6c39917c4d
2 changed files with 32 additions and 4 deletions
|
@ -4,6 +4,7 @@ import csv
|
|||
import hashlib
|
||||
import hmac
|
||||
import re
|
||||
import inspect
|
||||
|
||||
from io import StringIO
|
||||
from codecs import getincrementalencoder
|
||||
|
@ -125,3 +126,18 @@ def highlight_content(content, query):
|
|||
content, flags=re.I | re.U)
|
||||
|
||||
return content
|
||||
|
||||
|
||||
def is_flask_run_cmdline():
|
||||
"""Check if the application was started using "flask run" command line
|
||||
|
||||
Inspect the callstack.
|
||||
See https://github.com/pallets/flask/blob/master/src/flask/__main__.py
|
||||
|
||||
Returns:
|
||||
bool: True if the application was started using "flask run".
|
||||
"""
|
||||
frames = inspect.stack()
|
||||
if len(frames) < 2:
|
||||
return False
|
||||
return frames[-2].filename.endswith('flask/cli.py')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue