Re: [flask] Flask configuration best practices
- Aaron Rothenberg
- 2012-10-18 @ 17:02
This is not my question but your post was helpful. As a noob I'd like
to seehttp://flask.pocoo.org/docs/api/#flask.Flask.extensions in action.
This is not an answer to the question(I am brand new to Flask) but here a
list of "necessary practices" in order to be approved by Flask(I'm
doesn't have anything to say about config keys. I'm planning to use the
link loosely as a "best practices" guide.
> Date: Thu, 18 Oct 2012 10:27:09 +0200
> From: firstname.lastname@example.org
> Subject: Re: [flask] Flask configuration best practices
> To: email@example.com
> Le 18/10/2012 02:19, Desmond Rivet a écrit :
> > Hi all,
> > I'm wondering if there are any best practices in regards to Flask
> > For example, how do you guys prevent Flask plugins from stepping on
> > each other's toes with respect to configuration keys? Do you just
> > make sure each plugin's config keys begins with a different string?
> > Is it considered bad practice to "nest" configuration, i.e. store a
> > piece of config that points to another dictionary? Or do you guys
> > prefer to keep everything flat? Or do you guys have no opinion one
> > way or the other?
> > At the moment I'm writing a flask application that has its own
> > non-standard "plugin" structure. Each plugin can have it's own
> > configuration. I'm tempted to nest the config in the global flask
> > config object to prevent conflicts, but I just wanted to see what
> > everyone thought.
> I’m not sure what exactly you call a "plugin", but I think that the
> closest we have in Flask are extensions:
> The convention for extension configuration is to use config keys with a
> prefix based on the name of the extension. For example, Flask-SQLAlchemy
> uses SQLALCHEMY_DATABASE_URI rather than just DATABASE_URI.
> For run-time objects like a database connection pool, there is the
> app.extensions dict:
> Simon Sapin