Where to put configuration/data files

Tim Chase python.list at tim.thechases.com
Mon Feb 2 22:58:32 CET 2009

>> Is there a nice cross-platform way to figure out the Right
>> (tm) place to store configuration files and other data?
> For what purpose?  Global program config, user config, what?

I've found three main categories of settings like Aahz describes 
(of which I've used all in a single application):

global settings:
I usually keep these in the shared data-store (database or 
web-site/service).  This can include both global application 
settings such as the name of the institution running the app, or 
certain business-rules; and global user settings such as name, 
general preferences, colorschemes, etc.

machine-specific settings:
this relates to things like particular hardware configurations 
(path to the CD drive, resource-names/configurations for things 
like barcode/mag-stripe scanners, etc), or which server to 
connect to.  I usually store these in my application directory on 
Win32, or in /etc on *nix boxes.

User-specific per-machine settings:
This can include things like preferred window-layout (which may 
change depending on screen-size), stored 
passwords/authentication, cache-locations,
local document stores, etc.

There's one other odd-ball category I've seen but not used: 
portable storage on a USB drive.  It sorta crosses these 
boundaries being a bit of each (it's USB-drive specific, but can 
be moved from machine to machine).

Choose your best storage location by thinking what a user/admin 
would want for each setting.  Is it a global setting that all 
users need?  put it in a network store.  Is it something that 
pertains to a particular machine?  store it in either a 
machine-global repository or a user-specific repository accordingly.


More information about the Python-list mailing list