Pecan: object-dispatching Python web framework

Pecan is a lightweight and lean WSGI object-dispatching Python web framework focused on building HTTP-based applications.

Pecan python frameworkPecan is a lightweight and lean WSGI object-dispatching web framework focused on building HTTP-based applications. This Python framework provides object-dispatch style routing and was inspired by CherryPy, TurboGears, and Pylons. It comes bundled with a WSGI (Web Server Gateway Interface) development server based on Python's wsgiref.simpleserver.

Most of Openstack projects are on Pecan, as well as a lot of new projects such as Ceilometer, Ironic and Tuskar. It is especially useful for the REST-based API’s as it has full support for REST-style controllers. Pecan applies the object-dispatch routing paradigm to map HTTP methods to corresponding methods on the controller classes. And though Pecan wasn’t designed as a “full stack” framework and doesn't support sessions or databases out-of-the-box, a few lines of code can help to integrate them.

Pecan has minimum of essential Python framework functionality. It includes support for templating, error pages, serialization, extensions etc. Pecan has support for a number of templating engines (Mako, Genshi, Kajiki, Jinja2) and it is easy to add support for a new template system. The default template engine is Mako.

Pecan provides a simple and easy-to-use system for generating and serving JSON. Apart from extensible JSON and template language support, Pecan has extensible security framework for building HTTP-based applications. Pecan doesn’t have out-of-the-box support for authentication, but it provides necessary tools for the developer to handle both authentication and authorization.

Pecan is a great micro-framework for developing a full fledged web applications. Usage of simple Python-based configuration and object-dispatch for easy routing made it one of the best options for writing HTTP-based applications. Get more information on pecanpy.org.

Connect with our experts Let's talk