mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
use the cached app.
This commit is contained in:
parent
005b70ac23
commit
1319543448
@ -14,8 +14,8 @@ def app(environ, start_response):
|
|||||||
"""Simplest possible application object"""
|
"""Simplest possible application object"""
|
||||||
data = 'Hello, World!\n'
|
data = 'Hello, World!\n'
|
||||||
status = '200 OK'
|
status = '200 OK'
|
||||||
print("print to stdout in test app")
|
# print("print to stdout in test app")
|
||||||
sys.stderr.write("stderr, print to stderr in test app\n")
|
# sys.stderr.write("stderr, print to stderr in test app\n")
|
||||||
response_headers = [
|
response_headers = [
|
||||||
('Content-type','text/plain'),
|
('Content-type','text/plain'),
|
||||||
('Content-Length', str(len(data))),
|
('Content-Length', str(len(data))),
|
||||||
|
|||||||
@ -55,7 +55,7 @@ def create(req, sock, client, server, cfg):
|
|||||||
"REQUEST_METHOD": req.method,
|
"REQUEST_METHOD": req.method,
|
||||||
"QUERY_STRING": req.query,
|
"QUERY_STRING": req.query,
|
||||||
"RAW_URI": req.uri,
|
"RAW_URI": req.uri,
|
||||||
"SERVER_PROTOCOL": "HTTP/%s" % ".".join(map(str, req.version)),
|
"SERVER_PROTOCOL": "HTTP/%s" % ".".join(map(str, req.version))
|
||||||
}
|
}
|
||||||
|
|
||||||
# authors should be aware that REMOTE_HOST and REMOTE_ADDR
|
# authors should be aware that REMOTE_HOST and REMOTE_ADDR
|
||||||
|
|||||||
@ -61,7 +61,7 @@ class AsyncWorker(base.Worker):
|
|||||||
self.log.info("Autorestarting worker after current request.")
|
self.log.info("Autorestarting worker after current request.")
|
||||||
resp.force_close()
|
resp.force_close()
|
||||||
self.alive = False
|
self.alive = False
|
||||||
respiter = self.app.wsgi()(environ, resp.start_response)
|
respiter = self.wsgi(environ, resp.start_response)
|
||||||
if respiter == ALREADY_HANDLED:
|
if respiter == ALREADY_HANDLED:
|
||||||
return False
|
return False
|
||||||
try:
|
try:
|
||||||
|
|||||||
@ -56,7 +56,7 @@ class GeventWorker(AsyncWorker):
|
|||||||
pool = Pool(self.worker_connections)
|
pool = Pool(self.worker_connections)
|
||||||
if self.server_class is not None:
|
if self.server_class is not None:
|
||||||
server = self.server_class(
|
server = self.server_class(
|
||||||
self.socket, application=self.app.wsgi, spawn=pool, log=self.log,
|
self.socket, application=self.wsgi, spawn=pool, log=self.log,
|
||||||
handler_class=self.wsgi_handler)
|
handler_class=self.wsgi_handler)
|
||||||
else:
|
else:
|
||||||
server = StreamServer(self.socket, handle=self.handle, spawn=pool)
|
server = StreamServer(self.socket, handle=self.handle, spawn=pool)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user