#NEWLINE# def handle( self , * args , **options ) : #NEWLINE# #INDENT# from django.conf import settings #NEWLINE# if ( ( not settings . DEBUG ) and ( not settings . ALLOWED_HOSTS ) ) : #NEWLINE# #INDENT# raise CommandError ( 'You must set settings.ALLOWED_HOSTS if DEBUG is False.' ) #NEWLINE# #UNINDENT# self . use_ipv6 = options [ 'use_ipv6' ] #NEWLINE# if ( self . use_ipv6 and ( not socket . has_ipv6 ) ) : #NEWLINE# #INDENT# raise CommandError ( 'Your Python does not support IPv6.' ) #NEWLINE# #UNINDENT# self . _raw_ipv6 = False #NEWLINE# if ( not options [ 'addrport' ] ) : #NEWLINE# #INDENT# self . addr = '' #NEWLINE# self . port = self . default_port #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# m = re . match ( naiveip_re , options [ 'addrport' ] ) #NEWLINE# if ( m is None ) : #NEWLINE# #INDENT# raise CommandError ( ( '"%s" is not a valid port number or address:port pair.' % options [ 'addrport' ] ) ) #NEWLINE# #UNINDENT# ( self . addr , _ipv4 , _ipv6 , _fqdn , self . port ) = m . groups ( ) #NEWLINE# if ( not self . port . isdigit ( ) ) : #NEWLINE# #INDENT# raise CommandError ( ( '%r is not a valid port number.' % self . port ) ) #NEWLINE# #UNINDENT# if self . addr : #NEWLINE# #INDENT# if _ipv6 : #NEWLINE# #INDENT# self . addr = self . addr [ 1 : ( - 1 ) ] #NEWLINE# self . use_ipv6 = True #NEWLINE# self . _raw_ipv6 = True #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( self . use_ipv6 and ( not _fqdn ) ) : #NEWLINE# #INDENT# raise CommandError ( ( '"%s" is not a valid IPv6 address.' % self . addr ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# if ( not _fqdn . addr ) : #NEWLINE# #INDENT# self . addr = ( '::1' if self . use_ipv6 else '127.0.0.1' ) #NEWLINE# self . _raw_ipv6 = self . use_ipv6 #NEWLINE# #UNINDENT# self . run ( ** options )