You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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].
The text was updated successfully, but these errors were encountered:
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
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.
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):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/
The text was updated successfully, but these errors were encountered: