How can I turn on the cgitb debug on browser in wsgi?
# enable debugging
import cgitb
cgitb.enable()
def application(environ, start_response):
# build the response body possibly using the environ dictionary
response_body = 'The request method was %s' % environ['REQUEST_METHOD']
status = '200 OK'
response_headerx = [('Content-Type', 'text/plain'),
('Content-Length', str(len(response_body)))]
# Send them to the server using the supplied function
start_response(status, response_headers)
return [response_body]
error only can be found in Apache log's error.log,
NameError: global name 'response_headers' is not defined, referer: http://127.0.0.1/python-
while on the browser, I get this,
Server error!
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there was an error in a CGI script.
If you think this is a server error, please contact the webmaster.
Error 500
127.0.0.1 Apache/2.4.7 (Win32) mod_wsgi/4.4.12 Python/2.7.10 PHP/5.6.4
Any ideas?