uWSGI-pypy

view uwsgi-pypy.py @ 0:7bbae6efc126

first public commit
author roberto@debian32
date mer ago 17 11:28:14 2011 +0200 (2011-08-17)
parents
children
line source
1 import uwsgi_pypy
2 import sys
4 print sys.argv
6 from werkzeug.testapp import test_app as application
8 def pypy_wsgi_start_response(status, headers, exc_info=None):
9 uwsgi_pypy.send("HTTP/1.0 %s\r\n" % status)
10 for hh in headers:
11 uwsgi_pypy.send("%s: %s\r\n" % (hh[0], hh[1]))
13 if exc_info:
14 uwsgi_pypy.log(str(exc_info))
15 uwsgi_pypy.send("\r\n")
17 print application
19 def pypy_wsgi_adapter(env):
20 response = application(env, pypy_wsgi_start_response)
22 if isinstance(response, str):
23 uwsgi_pypy.send(response)
24 else:
25 for chunk in response:
26 uwsgi_pypy.send(chunk)
28 env.clear()
30 uwsgi_pypy.init(('--socket',':3031', '--master', '--processes', '4'))
32 uwsgi_pypy.log("ciao")