in my Django project, I have organised the settings as a module with a file structure like this:
/settings/
__init__.py
base.py
prod.py
dev.py
dev_user_a.py
dev_user_b.py
prod_user_a.py
prod_user_b.py etc.
They are working as a hierarchy, i.e. def_user_a.py
imports dev.py
, dev.py
imports base.py
.
__init__.py
imports one of the 'leaves', i.e. dev_user_a.py
, this is how each user can choose his settings. This works fine, except that I cannot seem to exclude /settings/__init__.py
from git, which means local changes to this file are likely to be accidentally broadcasted to other users.
Two questions:
- Is there a better way to achieve this, and how?
- Why does adding
__init__.py
to.gitignore
(or.git/info/exclude
) not work?