I have my project settings in settings.py file. There are database names, user names, host names etc. defined there. In project files I do import settings and then use the constants where needed like settings.HOST. For unit testing I would like to use different settings. How should I override the settings? I am not using django.
Override settings.py for testing
523 Views Asked by Euphorbium At
2
You could create a new file - say
local_settings.pyin which you override the specific settings for you debugging and testing purposes.Then you add this block at the end of your
settings.pyYou should add
local_settings.pyto your.gitignorefile to exclude this file from version control (if you are using git).This is the standard way Django does this by the way.