def handle_static(environ, start_response, path):
 try:
  text = open(path).read()
  if path.endswith('.ico'):
   resp = Response(text, headers=[('Content-Type', 'image/x-icon')])
  elif path.endswith('.html'):
   resp = Response(text, headers=[('Content-Type', 'text/html')])
  elif path.endswith('.txt'):
   resp = Response(text, headers=[('Content-Type', 'text/plain')])
  elif path.endswith('.css'):
   resp = Response(text, headers=[('Content-Type', 'text/css')])
  elif path.endswith('.js'):
   resp = Response(text, headers=[('Content-Type', 'text/javascript')])
  elif path.endswith('.png'):
   resp = Response(text, headers=[('Content-Type', 'image/png')])
  else:
   resp = Response(text)
 except IOError:
  resp = NotFound()
 return resp(environ, start_response)

def handle_static ( environ , start_response , path ) : try : text = open ( path ) . read ( ) if path . endswith ( '.ico' ) : resp = Response ( text , headers = [ ( 'Content-Type' , 'image/x-icon' ) ] ) elif path . endswith ( '.html' ) : resp = Response ( text , headers = [ ( 'Content-Type' , 'text/html' ) ] ) elif path . endswith ( '.txt' ) : resp = Response ( text , headers = [ ( 'Content-Type' , 'text/plain' ) ] ) elif path . endswith ( '.css' ) : resp = Response ( text , headers = [ ( 'Content-Type' , 'text/css' ) ] ) elif path . endswith ( '.js' ) : resp = Response ( text , headers = [ ( 'Content-Type' , 'text/javascript' ) ] ) elif path . endswith ( '.png' ) : resp = Response ( text , headers = [ ( 'Content-Type' , 'image/png' ) ] ) else : resp = Response ( text ) except IOError : resp = NotFound ( ) return resp ( environ , start_response )
creates a response for a static file .