 Tornado 6.5 Documentationapplications, and various supporting classes). • Client- and server-side implementions of HTTP (HTTPServer and AsyncHTTPClient). • An asynchronous networking library including the classes IOLoop and IOStream effect to a wildcard host pattern. 6.1.8 Running and deploying Since Tornado supplies its own HTTPServer, running and deploying it is a little different from other Python web frameworks. Instead of configuring When running behind a load balancer like nginx, it is recommended to pass xheaders=True to the HTTPServer constructor. This will tell Tornado to use headers like X-Real-IP to get the user’s IP address0 码力 | 272 页 | 1.12 MB | 3 月前3 Tornado 6.5 Documentationapplications, and various supporting classes). • Client- and server-side implementions of HTTP (HTTPServer and AsyncHTTPClient). • An asynchronous networking library including the classes IOLoop and IOStream effect to a wildcard host pattern. 6.1.8 Running and deploying Since Tornado supplies its own HTTPServer, running and deploying it is a little different from other Python web frameworks. Instead of configuring When running behind a load balancer like nginx, it is recommended to pass xheaders=True to the HTTPServer constructor. This will tell Tornado to use headers like X-Real-IP to get the user’s IP address0 码力 | 272 页 | 1.12 MB | 3 月前3
 Tornado 6.5 Documentationtornado.websocket — Bidirectional communication to the browser HTTP servers and clients tornado.httpserver — Non-blocking HTTP server tornado.httpclient — Asynchronous HTTP client tornado.httputil — Manipulate web applications, and various supporting classes). Client- and server-side implementions of HTTP (HTTPServer and AsyncHTTPClient). An asynchronous networking library including the classes IOLoop and IOStream similar effect to a wildcard host pattern.Running and deploying Since Tornado supplies its own HTTPServer, running and deploying it is a little different from other Python web frameworks. Instead of configuring0 码力 | 437 页 | 405.14 KB | 3 月前3 Tornado 6.5 Documentationtornado.websocket — Bidirectional communication to the browser HTTP servers and clients tornado.httpserver — Non-blocking HTTP server tornado.httpclient — Asynchronous HTTP client tornado.httputil — Manipulate web applications, and various supporting classes). Client- and server-side implementions of HTTP (HTTPServer and AsyncHTTPClient). An asynchronous networking library including the classes IOLoop and IOStream similar effect to a wildcard host pattern.Running and deploying Since Tornado supplies its own HTTPServer, running and deploying it is a little different from other Python web frameworks. Instead of configuring0 码力 | 437 页 | 405.14 KB | 3 月前3
 Python 标准库参考指南 2.7.18 freeze_support() test() An example of how a pool of worker processes can each run a SimpleHTTPServer.HttpServer instance while sharing a single listening socket. # # Example where a pool of http servers share from multiprocessing import Process, current_process, freeze_support from BaseHTTPServer import HTTPServer from SimpleHTTPServer import SimpleHTTPRequestHandler if sys.platform == 'win32': import multiprocessing number_of_processes): # create a single server object -- children will each inherit a copy server = HTTPServer(address, RequestHandler) # create child processes to act as workers for i in range(number_of_processes-1):0 码力 | 1552 页 | 7.42 MB | 9 月前3 Python 标准库参考指南 2.7.18 freeze_support() test() An example of how a pool of worker processes can each run a SimpleHTTPServer.HttpServer instance while sharing a single listening socket. # # Example where a pool of http servers share from multiprocessing import Process, current_process, freeze_support from BaseHTTPServer import HTTPServer from SimpleHTTPServer import SimpleHTTPRequestHandler if sys.platform == 'win32': import multiprocessing number_of_processes): # create a single server object -- children will each inherit a copy server = HTTPServer(address, RequestHandler) # create child processes to act as workers for i in range(number_of_processes-1):0 码力 | 1552 页 | 7.42 MB | 9 月前3
 Python 标准库参考指南 2.7.18 freeze_support() test() An example of how a pool of worker processes can each run a SimpleHTTPServer.HttpServer instance while sharing a single listening socket. # # Example where a pool of http servers share from multiprocessing import Process, current_process, freeze_support from BaseHTTPServer import HTTPServer from SimpleHTTPServer import SimpleHTTPRequestHandler if sys.platform == 'win32': import multiprocessing number_of_processes): # create a single server object -- children will each inherit a copy server = HTTPServer(address, RequestHandler) # create child processes to act as workers for i in range(number_of_processes-1):0 码力 | 1552 页 | 7.42 MB | 9 月前3 Python 标准库参考指南 2.7.18 freeze_support() test() An example of how a pool of worker processes can each run a SimpleHTTPServer.HttpServer instance while sharing a single listening socket. # # Example where a pool of http servers share from multiprocessing import Process, current_process, freeze_support from BaseHTTPServer import HTTPServer from SimpleHTTPServer import SimpleHTTPRequestHandler if sys.platform == 'win32': import multiprocessing number_of_processes): # create a single server object -- children will each inherit a copy server = HTTPServer(address, RequestHandler) # create child processes to act as workers for i in range(number_of_processes-1):0 码力 | 1552 页 | 7.42 MB | 9 月前3
 Python 标准库参考指南 2.7.18 freeze_support() test() An example of how a pool of worker processes can each run a SimpleHTTPServer.HttpServer instance while sharing a single listening socket. # # Example where a pool of http servers share from multiprocessing import Process, current_process, freeze_support from BaseHTTPServer import HTTPServer from SimpleHTTPServer import SimpleHTTPRequestHandler if sys.platform == 'win32': import multiprocessing number_of_processes): # create a single server object -- children will each inherit a copy server = HTTPServer(address, RequestHandler) # create child processes to act as workers for i in range(number_of_processes-1):0 码力 | 1552 页 | 7.42 MB | 9 月前3 Python 标准库参考指南 2.7.18 freeze_support() test() An example of how a pool of worker processes can each run a SimpleHTTPServer.HttpServer instance while sharing a single listening socket. # # Example where a pool of http servers share from multiprocessing import Process, current_process, freeze_support from BaseHTTPServer import HTTPServer from SimpleHTTPServer import SimpleHTTPRequestHandler if sys.platform == 'win32': import multiprocessing number_of_processes): # create a single server object -- children will each inherit a copy server = HTTPServer(address, RequestHandler) # create child processes to act as workers for i in range(number_of_processes-1):0 码力 | 1552 页 | 7.42 MB | 9 月前3
 Python 标准库参考指南 3.10.15 signal import socket from selectors import DefaultSelector, EVENT_READ from http.server import HTTPServer, SimpleHTTPRequestHandler interrupt_read, interrupt_write = socket.socketpair() def handler(signum return if key.fileobj == httpd: httpd.handle_request() print("Serving on port 8000") httpd = HTTPServer(('', 8000), SimpleHTTPRequestHandler) serve_forever(httpd) print("Shutdown...") 18.6. signal --- 函数能为你处理所有的细节。 1146 Chapter 21. 互联网协议和支持 The Python Library Reference, 发布 3.10.15 WSGIServer 是http.server.HTTPServer 的 子 类, 因 此 它 所 有 的 方 法 (例 如 serve_forever() 和 handle_request()) 都 是 可 用 的。WSGIServer 还 提 供 了 以0 码力 | 2072 页 | 10.39 MB | 9 月前3 Python 标准库参考指南 3.10.15 signal import socket from selectors import DefaultSelector, EVENT_READ from http.server import HTTPServer, SimpleHTTPRequestHandler interrupt_read, interrupt_write = socket.socketpair() def handler(signum return if key.fileobj == httpd: httpd.handle_request() print("Serving on port 8000") httpd = HTTPServer(('', 8000), SimpleHTTPRequestHandler) serve_forever(httpd) print("Shutdown...") 18.6. signal --- 函数能为你处理所有的细节。 1146 Chapter 21. 互联网协议和支持 The Python Library Reference, 发布 3.10.15 WSGIServer 是http.server.HTTPServer 的 子 类, 因 此 它 所 有 的 方 法 (例 如 serve_forever() 和 handle_request()) 都 是 可 用 的。WSGIServer 还 提 供 了 以0 码力 | 2072 页 | 10.39 MB | 9 月前3
 Python 标准库参考指南 3.10.15 signal import socket from selectors import DefaultSelector, EVENT_READ from http.server import HTTPServer, SimpleHTTPRequestHandler interrupt_read, interrupt_write = socket.socketpair() def handler(signum return if key.fileobj == httpd: httpd.handle_request() print("Serving on port 8000") httpd = HTTPServer(('', 8000), SimpleHTTPRequestHandler) serve_forever(httpd) print("Shutdown...") 18.6. signal --- BaseHTTPRequestHandler 的子类,它将被用来处理请求。 你通常不需要调用此构造器,因为make_server() 函数能为你处理所有的细节。 WSGIServer 是http.server.HTTPServer 的子类,因此它所有的方法 (例如 serve_forever() 和 handle_request()) 都是可用的。WSGIServer 还提供了以下 WSGI 专属的方法: set_app(application)0 码力 | 2207 页 | 10.45 MB | 9 月前3 Python 标准库参考指南 3.10.15 signal import socket from selectors import DefaultSelector, EVENT_READ from http.server import HTTPServer, SimpleHTTPRequestHandler interrupt_read, interrupt_write = socket.socketpair() def handler(signum return if key.fileobj == httpd: httpd.handle_request() print("Serving on port 8000") httpd = HTTPServer(('', 8000), SimpleHTTPRequestHandler) serve_forever(httpd) print("Shutdown...") 18.6. signal --- BaseHTTPRequestHandler 的子类,它将被用来处理请求。 你通常不需要调用此构造器,因为make_server() 函数能为你处理所有的细节。 WSGIServer 是http.server.HTTPServer 的子类,因此它所有的方法 (例如 serve_forever() 和 handle_request()) 都是可用的。WSGIServer 还提供了以下 WSGI 专属的方法: set_app(application)0 码力 | 2207 页 | 10.45 MB | 9 月前3
 Python 标准库参考指南 3.9.20 signal import socket from selectors import DefaultSelector, EVENT_READ from http.server import HTTPServer, SimpleHTTPRequestHandler interrupt_read, interrupt_write = socket.socketpair() def handler(signum return if key.fileobj == httpd: httpd.handle_request() print("Serving on port 8000") httpd = HTTPServer(('', 8000), SimpleHTTPRequestHandler) serve_forever(httpd) print("Shutdown...") 18.6. signal --- BaseHTTPRequestHandler 的子类,它将被用来处理请求。 你通常不需要调用此构造器,因为make_server() 函数能为你处理所有的细节。 WSGIServer 是http.server.HTTPServer 的子类,因此它所有的方法 (例如 serve_forever() 和 handle_request()) 都是可用的。WSGIServer 还提供了以下 WSGI 专属的方法: set_app(application)0 码力 | 2146 页 | 10.17 MB | 9 月前3 Python 标准库参考指南 3.9.20 signal import socket from selectors import DefaultSelector, EVENT_READ from http.server import HTTPServer, SimpleHTTPRequestHandler interrupt_read, interrupt_write = socket.socketpair() def handler(signum return if key.fileobj == httpd: httpd.handle_request() print("Serving on port 8000") httpd = HTTPServer(('', 8000), SimpleHTTPRequestHandler) serve_forever(httpd) print("Shutdown...") 18.6. signal --- BaseHTTPRequestHandler 的子类,它将被用来处理请求。 你通常不需要调用此构造器,因为make_server() 函数能为你处理所有的细节。 WSGIServer 是http.server.HTTPServer 的子类,因此它所有的方法 (例如 serve_forever() 和 handle_request()) 都是可用的。WSGIServer 还提供了以下 WSGI 专属的方法: set_app(application)0 码力 | 2146 页 | 10.17 MB | 9 月前3
 Python 标准库参考指南 3.9.20 signal import socket from selectors import DefaultSelector, EVENT_READ from http.server import HTTPServer, SimpleHTTPRequestHandler interrupt_read, interrupt_write = socket.socketpair() def handler(signum return if key.fileobj == httpd: httpd.handle_request() print("Serving on port 8000") httpd = HTTPServer(('', 8000), SimpleHTTPRequestHandler) serve_forever(httpd) print("Shutdown...") 964 Chapter 18 函数能为你处理所有的细节。 1120 Chapter 21. 互联网协议和支持 The Python Library Reference, 发布 3.9.20 WSGIServer 是http.server.HTTPServer 的 子 类, 因 此 它 所 有 的 方 法 (例 如 serve_forever() 和 handle_request()) 都 是 可 用 的。WSGIServer 还 提 供 了 以0 码力 | 2015 页 | 10.12 MB | 9 月前3 Python 标准库参考指南 3.9.20 signal import socket from selectors import DefaultSelector, EVENT_READ from http.server import HTTPServer, SimpleHTTPRequestHandler interrupt_read, interrupt_write = socket.socketpair() def handler(signum return if key.fileobj == httpd: httpd.handle_request() print("Serving on port 8000") httpd = HTTPServer(('', 8000), SimpleHTTPRequestHandler) serve_forever(httpd) print("Shutdown...") 964 Chapter 18 函数能为你处理所有的细节。 1120 Chapter 21. 互联网协议和支持 The Python Library Reference, 发布 3.9.20 WSGIServer 是http.server.HTTPServer 的 子 类, 因 此 它 所 有 的 方 法 (例 如 serve_forever() 和 handle_request()) 都 是 可 用 的。WSGIServer 还 提 供 了 以0 码力 | 2015 页 | 10.12 MB | 9 月前3
 Python 标准库参考指南 3.13 signal import socket from selectors import DefaultSelector, EVENT_READ from http.server import HTTPServer, SimpleHTTPRequestHandler interrupt_read, interrupt_write = socket.socketpair() def handler(signum return if key.fileobj == httpd: httpd.handle_request() print("Serving on port 8000") httpd = HTTPServer(('', 8000), SimpleHTTPRequestHandler) serve_forever(httpd) print("Shutdown...") 18.7 mmap --- BaseHTTPRequestHandler 的子类,它将被用来处理请求。 你通常不需要调用此构造器,因为make_server() 函数能为你处理所有的细节。 WSGIServer 是http.server.HTTPServer 的子类,因此它所有的方法 (例如 serve_forever() 和 handle_request()) 都是可用的。WSGIServer 还提供了以下 WSGI 专属的方法: set_app(application)0 码力 | 2246 页 | 11.74 MB | 9 月前3 Python 标准库参考指南 3.13 signal import socket from selectors import DefaultSelector, EVENT_READ from http.server import HTTPServer, SimpleHTTPRequestHandler interrupt_read, interrupt_write = socket.socketpair() def handler(signum return if key.fileobj == httpd: httpd.handle_request() print("Serving on port 8000") httpd = HTTPServer(('', 8000), SimpleHTTPRequestHandler) serve_forever(httpd) print("Shutdown...") 18.7 mmap --- BaseHTTPRequestHandler 的子类,它将被用来处理请求。 你通常不需要调用此构造器,因为make_server() 函数能为你处理所有的细节。 WSGIServer 是http.server.HTTPServer 的子类,因此它所有的方法 (例如 serve_forever() 和 handle_request()) 都是可用的。WSGIServer 还提供了以下 WSGI 专属的方法: set_app(application)0 码力 | 2246 页 | 11.74 MB | 9 月前3
共 22 条
- 1
- 2
- 3














