Where Do I Get a Secret_Key for Flask?
I Am Trying to Set up Flask-Debugtoolbar, but I Get the Message "Debugtoolbar Requires a Secret_Key". Where Do I Get the Secret Key? 0 5 Answers Get the Random...
I am trying to set up Flask-Debugtoolbar, but I get the message "DebugToolBar requires a SECRET_KEY". Where do I get the secret key?
5 Answers
Must Read
Get the random string for secret key:
Method 1: Use os in Python 2/3:
>>> import os
>>> os.urandom(12)
'\xf0?a\x9a\\\xff\xd4;\x0c\xcbHi'
Method 2: Use uuid in Python 2/3:
>>> import uuid
>>> uuid.uuid4().hex
'3d6f45a5fc12445dbac2f59c3b6c7cb1'
Method 3: Use secrets in Python >= 3.6:
>>> import secrets
>>> secrets.token_urlsafe(16)
'Drmhze6EPcv0fN_81Bj-nA'
>>> secrets.token_hex(16)
'8f42a73054b1749f8f58848be5e6502c'
Method 4: Use os in Python 3:
>>> import os
>>> os.urandom(12).hex()
'f3cfe9ed8fae309f02079dbf'