global variable settings_dict is not defined

when settings.USE_TZ is true, error occurs, settings_dict reference is not correctly scoped.