everyone. I have a simple wsgi server and a simple wsgi application.
**The application**
def app(environ, start_response):
start_response('200 OK', [('Content-type', 'text/plain')])
return ['Hello here']
**The server**
from wsgiref import simple_server
server = simple_server.WSGIServer(
('', 8080),
simple_server.WSGIRequestHandler,
)
server.set_app(app)
server.serve_forever()
Is there any way to handle any user’s request in separate process or maybe thread (i.e. execute app code) without using external framework? There is no common data in the process or thread expected. If it’s not possible, which way you can advise?
You may use
ThreadingMixInorForkingMixInfrom SocketServer module like this:ForkingMixIn will not work on Windows, though.
Replace ‘SocketServer’ with ‘socketserver’ if you’re using Python 3.