Skip to content
This repository has been archived by the owner on Sep 7, 2023. It is now read-only.

[WIP] Starlette #2313

Closed
wants to merge 2 commits into from
Closed

[WIP] Starlette #2313

wants to merge 2 commits into from

Conversation

dalf
Copy link
Contributor

@dalf dalf commented Nov 12, 2020

What does this PR do?

This is WIP, it is a first attempt to implement https://github.com/searx/searx/wiki/New-architecture-proposal

  • The Flask implementation is untouched (minor some cut / paste of some functions)
  • The Starlette implementation can be started using . ./local/py3/bin/activate; python -m searx.web

i18n:

  • There is no Flask_Babel package: see searx.web.i18n (missing function: format_date).
  • There is no request obect in the global scope, so gettext is available using request.state.gettext (currently there is no lazy / delayed evaluation ).
  • About Jinja2: see searx.web.templates.SearxJinja2Templates ( overlay.install_gettext_translations(get_translations(locale), newstyle=True))

image proxy:

searx.web.middleware should be a AWSGI middleware (currently it requires to await pre_request(request) )

/search: call SearchWithPlugins using a thread pool. The current implementation is really inefficient:

  • create / reuse a thread to call search.search
  • then create a thread per engine as usual.
  • the Search and SearchWithPlugins classes should deal with async.

I think get_base_url is not required with starlette : https://www.starlette.io/release-notes/#01211

Why is this change important?

This change should NOT be merged, it is a request for comment.

How to test this PR locally?

. ./local/py3/bin/activate; python -m searx.web with / without SEARX_DEBUG=1.

Author's checklist

Related issues

. ./local/py3/bin/activate
python -m searx.web
@dalf dalf added the core label Nov 23, 2020
@dalf dalf mentioned this pull request Dec 3, 2020
5 tasks
@dalf dalf mentioned this pull request Dec 27, 2020
This was referenced Jan 11, 2021
@dalf dalf closed this Apr 22, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant