Advertisement
Guest User

Minimal Python WSGI Hello World

a guest
Nov 27th, 2014
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.43 KB | None | 0 0
  1. from wsgiref.util import setup_testing_defaults
  2. from wsgiref.simple_server import make_server
  3.  
  4. def simple_app(environ, start_response):
  5.     start_response("200 OK",[('Content-type', 'text/html')] )
  6.     return ("""<button onclick="window.location='/hello'">say hello</button> """
  7.                 if "hello" not in environ["PATH_INFO"] else
  8.             """<h1>Hello World</h1>""")
  9.  
  10. make_server('', 8080, simple_app).serve_forever()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement