So, to have this functionality, but without warning I use this pattern:
try: import local_settings for setting in dir(local_settings): if setting.startswith('_'): continue locals()[setting] = getattr(local_settings, setting) except ImportError: pass
Simple and useful!
Update: I've added ignore of attributes which starting with underscore. Thanks to Igor Davydenko
hm, i think it's not right to copy all vars from local_settings, this will rewrite __name__, __file__ and other private vars of current settings
ReplyDeletefor setting in dir(local_settings):
if setting.startswith('_'):
continue
locals()[setting] = getattr(local_settings, setting)
Thanks! I've updated snippet
Delete