web programming note to enable special exception handling in cgi scriptsinclude the line import cgitbenable(at the beginning of the script wsgiref wsgi (python web server gateway interfaceis standardized interface between webservers and web applications that is designed to promote portability of applications across different webservers and frameworks an official description of the standard is found in pep (about the standard and its use can also be found at package is reference implementation that can be used for testingvalidationand simple deployments the wsgi specification with wsgia web application is implemented as function or callable object webapp(environstart_responsethat accepts two arguments environ is dictionary of environment settings that is minimally required to have the following values which have the same meaning and names as is used in cgi scriptingenviron variables description content_length content_type http_accept http_cookie http_referer http_user_agent path_info query_string request_method script_name server_name server_port server_protocol length of data passed type of query data mime types accepted by the client netscape persistent cookie value referring url client browser extra path information passed query string method ('getor 'post'name of the program server host name server port number server protocol in additionthe environ dictionary is required to contain the following wsgi-specific valuesenviron variables description wsgi version wsgi url_scheme tuple representing the wsgi version ( ( , for wsgi string representing the scheme component of the url for example'httpor 'httpsa file-like object representing the input stream additional data such as form data or uploads are read from this file-like object opened in text mode for writing error output wsgi input wsgi errors lib fl ff