Skip to content

Instantly share code, notes, and snippets.

@civic
Created March 5, 2021 07:52
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
wsgi-server.py
from wsgiref.simple_server import make_server, WSGIServer
from socketserver import ThreadingMixIn
import time
def hello_world_app(environ, start_response):
start_response('200 OK', [])
path_info = environ['PATH_INFO']
print(path_info)
time.sleep(3)
yield f"Hello World{path_info}\n".encode("utf8")
class ThreadedWSGIServer(ThreadingMixIn, WSGIServer):
pass
http = make_server('', 8000, hello_world_app, server_class=ThreadedWSGIServer)
http.serve_forever()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment