I was thinking a lot about this, I ended keeping my configurations in a
separate SQLITE database (because I will also run on GAE and it is easy to
change to datastore namespace)
Also I tested other options.
The better is a plan Python *.py file *located in /modules or /models you
can store CONSTANTS or even better a class with instance attributes for
configuration.
The second option for me is *ConfigParser*, it is a Python built in and is
very easy to write/read config .ini and .cfg files.
Another good option (also used by Sublime-text-2 editor) is plain
*JSON*files, you can create configuration.settings file and store
pure json
syntax there, so it will be easy to dumps or loads() it.
If you are planning to run on GAE, I recommend to use database for
configuration, you can use a different namespace for it, and when running
locally can use SQLITE.
Here it is my implementation of config, after long tests.
https://github.com/rochacbruno/Movuca/blob/master/modules/config.py
it rely on the setup datamodel:
https://github.com/rochacbruno/Movuca/blob/master/modules/datamodel/setup.py
and to access the configurations I do.
from config import Config
config = Config() # it needs to be an instance because you will have
problems using current at the top level or class level.
db = DAL(uri=config.db.uri, migrate_enabled=config.db.migrate_enables,
pool_size=config.db.pool_size)
Also, there are times when I need to store a list of tuples to use in
validators, so I created a method for that
db.table.field.requires = IS_IN_SET(config.get_list('auth',
'privacy_options'))
In the future I will cache the config instance in memcached.
If you app is a bit simpler you should go with plain Python files in
/modules or /models
--
Bruno Rocha
[http://rochacbruno.com.br]