Fixing errors in last commit. Optimizing settings.py for [ldap] configuration.