Skip to content

Instantly share code, notes, and snippets.

@bergpb
Created February 25, 2019 14:21
Show Gist options
  • Select an option

  • Save bergpb/69233350254cc7c650c3812512ec044a to your computer and use it in GitHub Desktop.

Select an option

Save bergpb/69233350254cc7c650c3812512ec044a to your computer and use it in GitHub Desktop.
Create a SECRET_KEY for Flask apps.
#using os, python2/3
import os
os.urandom(12)
#using uuid, python2/3
import uuid
uuid.uuid4().hex
#using secrets, python>=3.6
import secrets
secrets.token_urlsafe(16)
#using os in python3
import os
os.urandom(12).hex()
#tnks for
#https://stackoverflow.com/questions/34902378/where-do-i-get-a-secret-key-for-flask
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment