mirror of
https://github.com/searxng/searxng.git
synced 2025-09-03 08:48:35 +02:00
[fix] issues when launching a local development server
A local development server can be launched by one of these command lines:: $ flask --app searx.webapp run $ python -m searx.webapp The different ways of starting the server should lead to the same result, which is generally the case. However, if the modules are reloaded after code changes (reload option), it must be avoided that the application is initialized twice at startup. We have already discussed this in 2022 [1][2]. Further information on this topic can be found in [3][4][5]. To test a bash in the ./local environment was started and the follwing commands had been executed:: $ ./manage pyenv.cmd bash --norc --noprofile (py3) SEARXNG_DEBUG=1 flask --app searx.webapp run --reload (py3) SEARXNG_DEBUG=1 python -m searx.webapp Since the generic parts of the docs also initialize the app to generate doc from it, the build of the docs was also tested:: $ make docs.clean docs.live [1] https://github.com/searxng/searxng/pull/1656#issuecomment-1214198941 [2] https://github.com/searxng/searxng/pull/1616#issuecomment-1206137468 [3] https://flask.palletsprojects.com/en/stable/api/#flask.Flask.run [4] https://github.com/pallets/flask/issues/5307#issuecomment-1774646119 [5] https://stackoverflow.com/a/25504196 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
parent
5ae3b3f17e
commit
e9157b3c1a
8 changed files with 112 additions and 76 deletions
|
@ -9,7 +9,6 @@ import csv
|
|||
import hashlib
|
||||
import hmac
|
||||
import re
|
||||
import inspect
|
||||
import itertools
|
||||
import json
|
||||
from datetime import datetime, timedelta
|
||||
|
@ -316,21 +315,6 @@ def searxng_l10n_timespan(dt: datetime) -> str: # pylint: disable=invalid-name
|
|||
return format_date(dt)
|
||||
|
||||
|
||||
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')
|
||||
|
||||
|
||||
NO_SUBGROUPING = 'without further subgrouping'
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue