EnvironmentInfoedit frank, 17 July 2008 (created 06 July 2008)
When working in a new web environment, I like to explore the environment a little to discover any limitations that I may not have expected. For example, in certain environments you may discover some headers are missing, or there are extra environment variables that are useful to have.
For this sample, create a new folder envinfo and add envinfo/envinfo.py:
def env_app(environ, start_response): "Show environ verbosely" status = '200 OK' response_headers = [('Content-type','text/plain')] start_response(status, response_headers)
h = 'My environ is a %s\n' % type(environ) h += '\nIt contains these key:value pairs:\n\n' keys = environ.keys() keys.sort() for k in keys: h += '%s: %s\n' % (k,environ[k])
return [h]
# does not know nor care that it is running under AppEngine! from wsgiref.handlers import CGIHandler CGIHandler().run(env_app)