Skip to content

Instantly share code, notes, and snippets.

@iwanbk
Created March 7, 2012 08:47
Show Gist options
  • Save iwanbk/1992013 to your computer and use it in GitHub Desktop.
Save iwanbk/1992013 to your computer and use it in GitHub Desktop.
multiprocess gevent wsgi server
#original code from http://pastebin.com/EDwwNhqq
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.bind(("0.0.0.0", port))
fork()
address = socket.fromfd(s.fileno(), socket.AF_INET, socket.SOCK_STREAM)
address.listen()
server = gevent.wsgi.WSGIServer(address, application, log=None, spawn=wsgiServerWorkers)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment