fromWsgiref.simple_serverImport*defaaa (Environ,start_response):#Try: #request_body_size = Int (environ.get (' Content_length ', 0)) #except (valueerror): #request_body_size = 0 #request_body = environ[' Wsgi.input '].read (request_body_size) #print request_body+ "#"Start_response ("OK",[('Content-type',"text/html")]) return['AAAA']if __name__=='__main__': httpd= Make_server ("', 80, Aaa,wsgiserver,wsgirequesthandler) SA=Httpd.socket.getsockname ()Print 'http://{0}:{1}/'. Format (*sa)#Respond to requests until process is killedHttpd.serve_forever ()
The reason is
C:\Python27\Lib\BaseHTTPServer.py
def address_string (self): = Self.client_address[:2] return Socket.getfqdn (host)# Very slow here
print Socket.getfqdn ("192.168.1.101")# It's going to take about 10 seconds .
Solve:
Modify C:\Python27\Lib\wsgiref\simple_server.py
Host = Self.address_string ()#very slowhere ""
Troubleshooting Python (2.7) Webserver LAN is extremely slow in non-native access