Created
October 6, 2015 20:24
-
-
Save Voronenko/b018bc2322fa39cc588f to your computer and use it in GitHub Desktop.
Sample wsgi to test apache + mod_wsgi setup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cStringIO | |
import os | |
def application(environ, start_response): | |
headers = [] | |
headers.append(('Content-Type', 'text/plain')) | |
write = start_response('200 OK', headers) | |
input = environ['wsgi.input'] | |
output = cStringIO.StringIO() | |
print >> output, "PID: %s" % os.getpid() | |
print >> output, "UID: %s" % os.getuid() | |
print >> output, "GID: %s" % os.getgid() | |
print >> output | |
keys = environ.keys() | |
keys.sort() | |
for key in keys: | |
print >> output, '%s: %s' % (key, repr(environ[key])) | |
print >> output | |
output.write(input.read(int(environ.get('CONTENT_LENGTH', '0')))) | |
return [output.getvalue()] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment