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

Initialization on a group of blueprints #181

Closed
nogaems opened this issue Jan 26, 2020 · 4 comments
Closed

Initialization on a group of blueprints #181

nogaems opened this issue Jan 26, 2020 · 4 comments

Comments

@nogaems
Copy link

nogaems commented Jan 26, 2020

Is there a solid reason why there's no option of initializing on a group of blueprints? Say, I have a nested structure of blueprints, like it's done in sanic documentation. When I try to initialize on a corresponding api blueprint I get an error:

sanic_jwt.exceptions.InitializationFailure: Sanic JWT was not initialized properly. It must be instantiated on a sanic.Sanic or sanic.Blueprint instance.

My intention was to get /auth entry-point under /v1/api, is there any way to achieve that?

@ahopkins
Copy link
Owner

It should work if you create a BP at the api root. I will send a snippet later.

As the project currently stands, it does not stand up a Blueprint on a Blueprint Group. It either attaches to an existing Blueprint or creates a new Blueprint for your app.

https://github.com/ahopkins/sanic-jwt/blob/master/sanic_jwt/initialization.py#L331

@nogaems
Copy link
Author

nogaems commented Jan 26, 2020

Thanks for the quick response!
I guess, all I got to do is to specify url_prefix as /v1/api/auth manually during initialization?

@nogaems
Copy link
Author

nogaems commented Jan 26, 2020

I've just checked, it works fine. Thanks for help, this issue can be closed.

@ahopkins
Copy link
Owner

Thanks for the update. I'm going to open an issue for Blueprint Group support.

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

2 participants