Skip to content

Instantly share code, notes, and snippets.

@geoffalday
Created March 12, 2012 12:28
Show Gist options
  • Save geoffalday/2021517 to your computer and use it in GitHub Desktop.
Save geoffalday/2021517 to your computer and use it in GitHub Desktop.
How to generate a secret key with Python
# How to generate a secret key with Python
# via http://flask.pocoo.org/docs/quickstart/
import os
os.urandom(24)
@vijayabaskarFD
Copy link

For Python 2.X and Python 3.X

>>> import binascii
>>> binascii.hexlify(os.urandom(24))
b'0ccd512f8c3493797a23557c32db38e7d51ed74f14fa7580'

Did you get any solution for this. I too facing the same issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment