-
Notifications
You must be signed in to change notification settings - Fork 81
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
Mount problem #443
Comments
Hi @15864620573 In the second version of the framework, when you don´t specify a router for your application, by default it picks the default router - a singleton instantiated in blacksheep itself. In your example, both the mounted app and the parent app share the same route. This can be fixed instantiating a specific router for (at least) one of the two applications. from blacksheep import Application, Router
parent = Application(router=Router())
@parent.router.get("/")
def parent_home():
return "Hello, from the parent app"
child = Application()
@child.router.get("/")
def child_home():
return "Hello, from the child app"
parent.mount_registry.auto_events = True
parent.mount("/sub", child) I will improve the documentation regarding mount to clarify this point, and think of issuing warnings / raising a more specific exception. |
I forgot to mention, @15864620573, if you want to disable the default singleton router, you can use the Environment Variable |
- Fixes #441 causing the `refresh_token` endpoint for OpenID Connect integrations to not work when authentication is required by default. - Fixes #427, handling WebSocket errors according to ASGI specification. - Fixes #443, raising a detailed exception when more than one application is sharing the same instance of `Router` - Fixes #438 and #436, restoring support for `uvicorn` used programmatically and reloading the application object more than once in the same process.
For example, in this example, although it is mounted, it will not start and will give a route conflict error.
Why is that? Isn't it already mounted?
The text was updated successfully, but these errors were encountered: