#NEWLINE# def run( self ) : #NEWLINE# #INDENT# '\n        Sets up the live server and databases, and then loops over handling\n        http requests.\n        ' #NEWLINE# if self . connections_override : #NEWLINE# #INDENT# from django.db import connections #NEWLINE# for ( alias , conn ) in self . connections_override . items ( ) : #NEWLINE# #INDENT# connections [ alias ] = conn #NEWLINE# #UNINDENT# #UNINDENT# try : #NEWLINE# #INDENT# handler = StaticFilesHandler ( _MediaFilesHandler ( WSGIHandler ( ) ) ) #NEWLINE# for ( index , port ) in enumerate ( self . possible_ports ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# self . httpd = StoppableWSGIServer ( ( self . host , port ) , QuietWSGIRequestHandler ) #NEWLINE# #UNINDENT# except WSGIServerException as e : #NEWLINE# #INDENT# if ( ( ( index + 1 ) < len ( self . possible_ports ) ) and hasattr ( e . args [ 0 ] , 'errno' ) and ( e . args [ 0 ] . errno == errno . EADDRINUSE ) ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# self . port = port #NEWLINE# break #NEWLINE# #UNINDENT# #UNINDENT# self . httpd . set_app ( handler ) #NEWLINE# self . is_ready . set ( ) #NEWLINE# self . httpd . serve_forever ( ) #NEWLINE# #UNINDENT# except Exception as e : #NEWLINE# #INDENT# self . error = e #NEWLINE# self . is_ready . set ( )