#NEWLINE# def handle( self , * args , **options ) : #NEWLINE# #INDENT# chars = 'abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)' #NEWLINE# options [ 'nevercache_key' ] = get_random_string ( 50 , chars ) #NEWLINE# options [ 'files' ] . append ( 'local_settings.py.template' ) #NEWLINE# super ( Command , self ) . handle ( * args , ** options ) #NEWLINE# target = options . get ( 'target' , None ) #NEWLINE# if ( django . VERSION < ( 1 , 8 ) ) : #NEWLINE# #INDENT# name = ( args [ 0 ] if args else None ) #NEWLINE# if ( target is None ) : #NEWLINE# #INDENT# target = ( args [ 1 ] if ( len ( args ) > 1 ) else None ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# name = options [ 'name' ] #NEWLINE# if ( target is None ) : #NEWLINE# #INDENT# target = options [ 'directory' ] #NEWLINE# #UNINDENT# #UNINDENT# project_dir = self . get_project_directory ( name , target ) #NEWLINE# project_app_dir = os . path . join ( project_dir , name ) #NEWLINE# path = os . path . join ( project_app_dir , 'local_settings.py.template' ) #NEWLINE# if os . path . exists ( path ) : #NEWLINE# #INDENT# move ( path , os . path . join ( project_app_dir , 'local_settings.py' ) ) #NEWLINE# #UNINDENT# alt = options . pop ( 'alt' , '' ) #NEWLINE# if alt : #NEWLINE# #INDENT# options [ 'template' ] = six . text_type ( os . path . join ( os . path . dirname ( os . path . abspath ( import_module ( alt ) . __file__ ) ) , 'project_template' ) ) #NEWLINE# key = ( 'target' if ( django . VERSION < ( 1 , 8 ) ) else 'directory' ) #NEWLINE# options [ key ] = mkdtemp ( ) #NEWLINE# self . handle ( * args , ** options ) #NEWLINE# copy_tree ( options [ key ] , project_dir ) #NEWLINE# rmtree ( options [ key ] )