#NEWLINE# @ cli . command ( 'ensure-secret' ) #NEWLINE# @ click . argument ( 'conf_file' ) #NEWLINE# def ensure_secret( conf_file ) : #NEWLINE# #INDENT# dirname = os . path . dirname ( conf_file ) #NEWLINE# if ( not os . path . isdir ( dirname ) ) : #NEWLINE# #INDENT# os . makedirs ( dirname ) #NEWLINE# #UNINDENT# if os . path . exists ( conf_file ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# with open ( secret_key , 'w' ) as f : #NEWLINE# #INDENT# secret_key = '' . join ( [ random . choice ( string . ascii_letters ) for i in range ( 50 ) ] ) #NEWLINE# print ( 'SECRET_KEY: "{0}"' . format ( secret_key ) , file = f )