Эх сурвалжийг харах

HUE-2436 [desktop] Django-1.6: We now need a SECRET_KEY set or django won't start

Erick Tryzelaar 11 жил өмнө
parent
commit
78b99a0741

+ 3 - 1
desktop/core/src/desktop/settings.py

@@ -326,7 +326,9 @@ DEFAULT_FROM_EMAIL = desktop.conf.SMTP.DEFAULT_FROM.get()
 # Used for securely creating sessions.  Should be unique and not shared with anybody.
 # Used for securely creating sessions.  Should be unique and not shared with anybody.
 SECRET_KEY = desktop.conf.SECRET_KEY.get()
 SECRET_KEY = desktop.conf.SECRET_KEY.get()
 if SECRET_KEY == "":
 if SECRET_KEY == "":
-  logging.warning("secret_key should be configured")
+  logging.warning("secret_key is not configured. all sessions will be lost on restart")
+  import uuid
+  SECRET_KEY = str(uuid.uuid4())
 
 
 # SAML
 # SAML
 SAML_AUTHENTICATION = 'libsaml.backend.SAML2Backend' in AUTHENTICATION_BACKENDS
 SAML_AUTHENTICATION = 'libsaml.backend.SAML2Backend' in AUTHENTICATION_BACKENDS