”;
Python is versatile enough to create many types of applications ans programs that drive the internet or other computer networks. One important aspect of internet is the web servers that are at the root of the client server model. In this chapter we will see few web servers which are created uaing pure python language.
Gunicorn
Gunicorn is a stand-alone web server which has a central master process tasked with managing the initiated worker processes of differing types. These worker processes then handle and deal with the requests directly. And all this can be configured and adapted to suit the diverse needs of production scenarios.
Important Features
- It supports WSGI and can be used with any WSGI running Python application and framework
- It can also be used as a drop-in replacement for Paster (ex: Pyramid), Django”s Development Server, web2py, etc
- Offers the choice of various worker types/configurations and automatic worker process management
- HTTP/1.0 and HTTP/1.1 (Keep-Alive) support through synchronous and asynchronous workers
- Comes with SSL support
- Extensible with hooks
CherryPy WSGI Server
CherryPy is a self contained web framework as it can run on its own without the need of additional software. It has its own WSGI, HTTP/1.1-compliant web server. As it is a WSGI server, it can be used to serve any other WSGI Python application as well, without being bound to CherryPy”s application development framework.
Important Features
- It can run any Python web applications running on WSGI.
- It can handle static files and it can just be used to serve files and folders alone.
- It is thread-pooled.
- It comes with support for SSL.
- It is an easy to adapt, easy to use pure-Python alternative which is robust and reliable.
Twisted Web
It is a web server that comes with the Twisted networking library. Whereas Twisted itself is “an event-driven networking engine”, the Twisted Web server runs on WSGI and it is capable of powering other Python web applications.
Important Features
- It runs WSGI Python applications
- It can act like a Python web server framework, allowing you to program it with the language for custom HTTP serving purposes
- It offers simple and fast prototyping ability through Python Scrips (.rpy) which are executed upon HTTP requests
- It comes with proxy and reverse-proxy capabilities
- It supports Virtual Hosts
- • It can even serve Perl, PHP et cetera
”;