A Python module I'm developing has a master configuration file in /path/to/module/conf.conf
. The /path/to/module
/ depends on the platform (for instance, /Users/me/module
in OS X, /home/me/module
in Linux, etc).
Currently I define the /path/to/module
in __init__.py
, where I use logic:
if sys.platform == 'darwin':
ROOT = '/Users/me/module'
elif sys.platform == 'linux':
ROOT = '/home/me/module'
# et cetera
Once I have the configuration file root directory, I can open conf.conf
anywhere I want.
Do you have a better methodology?