Hello, what would be the proper way to access the application object from a blueprint? More specifically, I would like to access the application's configuration from a blueprint. Thanks! Fred
`current_app` might help http://flask.pocoo.org/docs/api/#flask.current_app 2011/7/14 Frédéric Back <frederic.back@tetraeder.com> > Hello, > > what would be the proper way to access the application object from a > blueprint? More specifically, I would like to access the application's > configuration from a blueprint. > > Thanks! > Fred > > > >
It does. Thanks! On Do, 2011-07-14 at 17:23 +0800, Daniel , Dao Quang Minh wrote: > `current_app` might help > > http://flask.pocoo.org/docs/api/#flask.current_app > > 2011/7/14 Frédéric Back <frederic.back@tetraeder.com> > Hello, > > what would be the proper way to access the application object > from a > blueprint? More specifically, I would like to access the > application's > configuration from a blueprint. > > Thanks! > Fred > > > > >
Hey, I know this would create a circular dependancy, but it works just fine. 2011/7/14 Frédéric Back <frederic.back@tetraeder.com> > It does. Thanks! > > On Do, 2011-07-14 at 17:23 +0800, Daniel , Dao Quang Minh wrote: > > `current_app` might help > > > > http://flask.pocoo.org/docs/api/#flask.current_app > > > > 2011/7/14 Frédéric Back <frederic.back@tetraeder.com> > > Hello, > > > > what would be the proper way to access the application object > > from a > > blueprint? More specifically, I would like to access the > > application's > > configuration from a blueprint. > > > > Thanks! > > Fred > > > > > > > > > > > > > -- Regards, Ishbir Singh
Hey, Why not just import the app object from the respective module? 2011/7/14 Frédéric Back <frederic.back@tetraeder.com> > Hello, > > what would be the proper way to access the application object from a > blueprint? More specifically, I would like to access the application's > configuration from a blueprint. > > Thanks! > Fred > > > > -- Regards, Ishbir Singh
In my case, that would create a circular dependency, since the main application imports the blueprint. Of course, I could simply import the configuration from a common module or something, but wouldn't that break the purpose of the blueprint? To be modular enough to work in different applications? It seems to me that accessing the application's config directly would be the cleanest way to solve my problem, but I'm unsure if this is even possible. On Do, 2011-07-14 at 14:48 +0530, Ishbir Singh wrote: > Hey, > > Why not just import the app object from the respective module? > > 2011/7/14 Frédéric Back <frederic.back@tetraeder.com> > Hello, > > what would be the proper way to access the application object > from a > blueprint? More specifically, I would like to access the > application's > configuration from a blueprint. > > Thanks! > Fred > > > > > > > -- > Regards, > Ishbir Singh >