I work on a custom documentation management system with Django.
Currently there is a productive envoirment on an IIS + Hyper-V with a database, let's call it productiveDB.
New features are implemented locally in different branches, using another database, let's call this one stagingDB.
When I work locally on a new branch I have to adjust the database configuration and credentials from productiveDB to stagingDB in my settings.py - furthermore I set the DEBUG Mode to True. When I commit my changes and merge into master, I sometimes forget to adjust the settings and this is where my question begins:
What is the best practice to handle this 'inattention'? Sure, I could keep the local settings adjusted for the staging envoirment and vice versa for the productive settings but here and then I have to add new settings to the aformentioned file and therefore I would have to commit the edited settings.py.
Is there a 'build in' way in GitLab or git to mark specific variables and change them according to the branch they are under? Like: if branch=master then set DEBUG=FALSE, DATABASE=productiveDB before while the CI/CD pipeline is running or do I have to stick to a custom script?