Publish date: Aug 13, 2019
- is the art of locating the appropriate page handler for a given request
- Usually, dispatching is based on the request’s URL, the query-string and, sometimes, the request’s method (GET, POST, etc.)
- A hook point is a point during the request/response processing “on_start_resource” - The earliest hook; the Request-Line and request headers have been processed and a dispatcher has set request.handler and request.config.
- Plugins, simply put, are entities that play with the bus, either by publishing or subscribing to channels, usually both at the same time.
- create your own plugins
- enable/disable a plugin
- Micro web frameworks,
- Minimal framework for creating APIs
- Very fast, netflix uses it to route traffic b/w datacentres, disney, splunk
- came in 2002, relatively old
- Class name is usually the
- Bulitin HTTP server
cherrypy.quickstarthas handlers for
uWSGI, development server, tornado application, tie into Django
- HTTP server mounts the class which has index method in it.
cherrypy.toolsare like Django middleware. Can manupulate response before or after you are done with it.
- tools to upload/download file
- Application level, mostly routing, specifying static folder location, manually changing header
- what HTTP server do we use? which port?
- Make your won cherry tools using
- 8 hooks provided by cherrypy to insert handler
graftingcan have multiple SPA running on same URL
- minimalistic server is 6 lines of code
- Multiple apps could be mounted at different routes
- Process monitoring with
- A HTTP/1.1-compliant, WSGI thread-pooled webserver. Typically, CherryPy itself takes only 1–2 ms per page.
- CherryPy 3 has fastest WSGI server yet 12/23/06
- CherryPy uses a tree-based mapper which does not accommodate well with segments that have no physical reality as a Python object
most arcane standard library module
- Most ingolorious programmers start with print statements unless it hits them in face
- By default would show only the warning, why worry about things which are going good.
- logging module assumes a lot of things
- Handler to make HTTP POST calls of standard logging events
FORMAT = '[%(asctime)s] - [%(levelname)s] - %(message)s' logging.basicConfig( level=logging.INFO, format=FORMAT )
- Everything info level and above, default is warning level and above.
- Give us more infomration that we did not put in
- Send JSON / HTML response
- Accept JSON input request