diff options
| author | Markus Heiser <markus.heiser@darmarit.de> | 2025-04-09 14:01:01 +0200 |
|---|---|---|
| committer | Markus Heiser <markus.heiser@darmarIT.de> | 2025-04-22 14:26:11 +0200 |
| commit | e9157b3c1a502a5898d370c0e98cc3e5ef8ef3f0 (patch) | |
| tree | d36bc2dcbcd60e33c41f71daa4810b6a211ca0ba /searx/network | |
| parent | 5ae3b3f17efe50fc1dc103360eeaedc7679448f3 (diff) | |
[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>
Diffstat (limited to 'searx/network')
| -rw-r--r-- | searx/network/network.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/searx/network/network.py b/searx/network/network.py index 84aaebe34..178ebcbf2 100644 --- a/searx/network/network.py +++ b/searx/network/network.py @@ -12,7 +12,7 @@ from typing import Dict import httpx -from searx import logger, searx_debug +from searx import logger, sxng_debug from searx.extended_types import SXNG_Response from .client import new_client, get_loop, AsyncHTTPTransportNoHttp from .raise_for_httperror import raise_for_httperror @@ -186,7 +186,7 @@ class Network: local_address = next(self._local_addresses_cycle) proxies = next(self._proxies_cycle) # is a tuple so it can be part of the key key = (verify, max_redirects, local_address, proxies) - hook_log_response = self.log_response if searx_debug else None + hook_log_response = self.log_response if sxng_debug else None if key not in self._clients or self._clients[key].is_closed: client = new_client( self.enable_http, |