Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serve multiple instances with different data domains #5

Open
amotl opened this issue Dec 25, 2020 · 0 comments
Open

Serve multiple instances with different data domains #5

amotl opened this issue Dec 25, 2020 · 0 comments

Comments

@amotl
Copy link
Contributor

amotl commented Dec 25, 2020

Hi there,

while I recognized that @linar-jether planned to bring Flask Blueprints [1] into the mix, I am aiming at serving multiple data domains from a single Python Flask app. That would mean that we should not have the dictionaries to register the data generator functions on the global (module) scope.

metric_finders = {}
metric_readers = {}
annotation_readers = {}
panel_readers = {}

I wanted to reuse the service routines providing the /search, /query, /annotations and /panels endpoints within a dedicated component which can be instantiated multiple times on different URL prefixes like /domain-1/search, /domain-1/query and so forth, like @cbsmith states it at pallets/flask#612 (comment):

I am trying to have the same blueprint registered with multiple prefixes [...]

First, I tried to use Flask-Classful [2] for that job but failed. With that extension, route handlers can be defined on a class level but still the servicing is also provided on the class level and not on an object instance level.

Also, it is apparently not possible by using Flask Blueprints as we also can't make those components obtain different data to operate on. The whole discussion at pallets/flask#612 very much demonstrates this issue.

So, we might think about swapping out Flask and using Pyramid or FastAPI as a web framework in the long run. However, an alternative could be Flask Application Dispatching [3].

With kind regards,
Andreas.

[1] https://flask.palletsprojects.com/en/1.1.x/blueprints/
[2] https://github.com/teracyhq/flask-classful
[3] https://flask.palletsprojects.com/en/1.1.x/patterns/appdispatch/

@amotl amotl changed the title Using real web components for serving multiple data domains from the same Python application Serve multiple instances with different data domains Feb 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant