Fixed #20081 -- Minimized risk of SECRET_KEY leak.

By default set the SECRET_KEY value to be loaded from env vars.  If not
set and DEBUG==True generate a random SECRET_KEY.  Also adds the
generatesecret management command, which prints a random secret key to
stdout.
The `except: raise` is redundant, right?