yum install mod_wsgiOn FreeBSD:
make -C /usr/ports/www/mod_wsgi install clean
WSGIScriptAlias /wsgi/ /var/www/wsgi/ <Directory /var/www/wsgi> Order allow,deny Allow from all </Directory>
#!/usr/bin/python import urlparse def application(environ, start_response): params = urlparse.parse_qs(environ["QUERY_STRING"] body = "query strings:\n" for k in sorted(params.iterkeys()): body += k + ":\n " body += "\n ".join(params[k]) + "\n\n" start_response("200 Ok", [("Content-Type", "text/plain"), ("Content-Length", str(len(body)))]) return [body]
#!/usr/bin/python import urlparse def application(environ, start_response): params = urlparse.parse_qs(environ["QUERY_STRING"] writer = start_response("200 Ok", [("Content-Type", "text/plain")]) writer("query strings:\n") for k in sorted(params.iterkeys()): writer(k + ":\n ") writer("\n ".join(params[k]) + "\n\n") return [""]
#!/usr/bin/python import urlparse def application(environ, start_response): reader = environ["wsgi.input"] contentlen = int(environ["CONTENT_LENGTH"]) params = urlparse.parse_qs(reader.read(contentlen)) writer = start_response("200 Ok", [("Content-Type", "text/plain")]) writer("post strings:\n") for k in sorted(params.iterkeys()): writer(k + ":\n ") writer("\n ".join(params[k]) + "\n\n") return ["last line of output\n"]