In production server local_settings
does not exists so the import will failed. But when you are trying to import from production_settings
you are just ignoring the exception if it is raised. Do not use try
and except
while importing from production_settings
. I wonder if there is some exception is raised and that is why those changes are not being reflected. For example one exception which i thought of is that may be INSTALLED_APPS
is a tuple in settings.py
but PROD_APPS
is a list (or vice versa) so concatination of tuple with list will raise TypeError
.
Better way:
try:
from local_settings import *
INSTALLED_APPS += LS_APPS
MIDDLEWARE_CLASSES += LS_MIDDLEWARE_CLASSES
except ImportError:
from production_settings import *
INSTALLED_APPS += PROD_APPS