Moves SECRET_KEY generation to base settings.py file

By putting the fallback SECRET_KEY generation into the base
settings.py file we can ensure there is always a SECRET_KEY
even if local_settings.py doesn't exist. All this really does
is move the current default in local_settings.py into
settings.py.

This fixes the failures during docs building, etc. due to
SECRET_KEY not being set.

Contains a few changes to fix errors/warnings during
docs building as well.

Fixes bug 1188622 and fixes bug 1178663.

Change-Id: I5d945deba7062fe42bcee2e7636ca4a8f4607a31
Merge "Moves SECRET_KEY generation to base settings.py file"