Non-evil multithreaded WSGI server?

G

Gerhard Häring

In a recent experiment I've done this:

from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
from wsgiref.simple_server import make_server, demo_app
from SocketServer import ThreadingMixIn

# Let's make a WSGI server that can use multiple threads.

class ThreadedHTTPServer(ThreadingMixIn, HTTPServer):
"""Handle requests in a separate thread."""

# Evil! ;-)
from wsgiref.simple_server import WSGIServer as MyWSGIServer
MyWSGIServer.__bases__ = (ThreadedHTTPServer,)

Now I wonder if there's a less evil way that does not involve copy &
paste of the WSGIServer code (only couple of lines, but I hate
duplication)?!

-- Gerhard
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top