[Twisted-Python] [twisted-web] I/O error with twisted.web.wsgi and Django

exarkun at twistedmatrix.com exarkun at twistedmatrix.com
Mon Mar 3 05:17:57 MST 2014


On 27 Feb, 11:21 am, orestis at orestis.gr wrote:
>Hi all,
>
>I am using Twisted Web WSGIResource to host a Django site. Here's the 
>code I use to setup the WSGI resource (other boilerplate skipped)
>
>def wsgi_resource():
>     from django.core.handlers.wsgi import WSGIHandler
>     pool = threadpool.ThreadPool()
>     pool.start()
>     # Allow Ctrl-C to get you out cleanly:
>     reactor.addSystemEventTrigger('after', 'shutdown', pool.stop)
>     wsgi_resource = wsgi.WSGIResource(reactor, pool, WSGIHandler())
>     return wsgi_resource
>
>This generally worked quite well. However I have an API endpoint that 
>gets hit with multiple POST requests per second (not very much - I'd 
>say 10-20 req/sec at most). Sometimes I see this in the logs:

If you can put together an http://sscce.org/ it would be easier to 
investigate this problem. :)

Jean-Paul



More information about the Twisted-Python mailing list