There is an alternative, perhaps more flexible approach to this. Do not exclude the file settings.py.
Instead, do the following:
try:
from localsettings import *
except ImportError:
pass
, - settings.py, . , , , localsettings.
localsettings.py , ( DEBUG, , , ).
, localsettings.py .