Hi Nico, Thanks for that!
I suppose this should really go into the web2py book, we can't expect people to read the source for something as basic (i.e. not an advanced feature or special use case) as this. I'm happy to go into github and create a pull request, I'm just not sure where we should place this. Perhaps we should add a section at the top of: http://www.web2py.com/books/default/chapter/29/13/deployment-recipes Or maybe it requires a section of its own? I also think something should be mentioned in: http://www.web2py.com/books/default/chapter/29/04/the-core#Workflow On Sat, Feb 13, 2016 at 5:26 PM, Nico de Groot <[email protected]> wrote: > From the source: > > appconfig.py: > > Read from configuration files easily without hurting performance. > > USAGE: > During development you can load a config file either in .ini or .json > format (by default app/private/appconfig.ini or app/private/appconfig.json) > The result is a dict holding the configured values. Passing reload=True is > meant only for development: in production, leave reload to False and all > values will be cached > > from gluon.contrib.appconfig import AppConfig > myconfig = AppConfig(path_to_configfile, reload=False) > print myconfig['db']['uri'] > > The returned dict can walk with "dot notation" an arbitrarely nested dict > > . print myconfig.take('db.uri') > > You can even pass a cast function, i.e. > > . print myconfig.take('auth.expiration', cast=int) > > Once the value has been fetched (and casted) it won't change until the > process is restarted (or reload=True is passed). > > Please search in this group for more info. > > Nico de Groot > > -- > Resources: > - http://web2py.com > - http://web2py.com/book (Documentation) > - http://github.com/web2py/web2py (Source code) > - https://code.google.com/p/web2py/issues/list (Report Issues) > --- > You received this message because you are subscribed to a topic in the > Google Groups "web2py-users" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/web2py/1sBjyKQSY-U/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.

