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

Add config parser to blueprints #631

Closed
jhutchins opened this issue Nov 8, 2012 · 2 comments
Closed

Add config parser to blueprints #631

jhutchins opened this issue Nov 8, 2012 · 2 comments

Comments

@jhutchins
Copy link

I think that it would be useful to be able to add configuration items to a blueprint and then have those merged into the app configuration on load. My thinking is simply that there might be configurations specific to your blueprint that should have default values stored as part of the blueprint. I suppose this feature could also lead to use cases where people make blueprint simply to hold different configuration for the application.

@soulseekah
Copy link
Contributor

I sometimes resort to doing things like this:

def config( state ):
    state.app.config.from_pyfile( ... )
my_blueprint.record_once( config )

https://github.com/mitsuhiko/flask/blob/master/flask/blueprints.py#L107

This pattern could also be used to simply hold different configurations for the application, although I the config module has a handful of good helpers for that.

@jeffwidman
Copy link
Contributor

Many Flask extensions add configuration items to an app that can then be overridden by the user. I haven't dug into that part of the code, but I suspect you could simply expand your generic blueprint into a custom flask extension to achieve what you want.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants