Server
Server(WSGI) creates and listens at the HTTP socket, dispatching the requests to a handler.
Last updated
Was this helpful?
Server(WSGI) creates and listens at the HTTP socket, dispatching the requests to a handler.
Last updated
Was this helpful?
WSGIRef server but uses threads to handle requests by using the . This is useful to handle web browsers pre-opening sockets, on which Server would wait indefinitely.
can used with any WSGI compatible web framework
this is a wsgiref based server
is a built-in WSGI package that provides various classes and helpers to develop against WSGI. Mostly it provides a basic WSGI server that can be used for testing or simple demos. WSocket provides support for websocket on wsgiref for testing purpose. It can only initiate connections one at a time, as a result of being single threaded. but WSocket WSGI server is multi threaded HTTP server. So it can handle many connections at a time.
if app not given it runs demo app you can use following values as host
to run local server(named localhost)
"localhost"
"127.0.0.1"
""
default host
is "127.0.0.1".
default port
is 8080. If port is 0, It will choose random port.
default server_cls
is ThreadingWSGIServer
example :
Create a ThreadingWSGIServer instance. server_address should be a (host,port) tuple, and RequestHandlerClass should be the subclass of http.server.BaseHTTPRequestHandler that will be used to process requests.
You do not normally need to call this constructor, as the make_server()
function can handle all the details for you.
set_app(application)
- Sets the callable application as the WSGI application that will receive requests.
get_app()
- Returns the currently-set application callable.
Normally, however, you do not need to use these additional methods, as [set_app()
] is normally called by make_server()
, and the [get_app()
] exists mainly for the benefit of request handler instances.
default handler_cls
is (base class of )
app
should be a valid application. example :
Create a new WSGIServer server listening on host and port, accepting connections for app. The return value is an instance of the supplied server_class, and will process requests using the specified handler_class. app must be a WSGI application object, as defined by .
ThreadingWSGIServer
is a subclass of . [ThreadingWSGIServer
] also provides these WSGI-specific methods: