by Dylan Jay

Heritage of Pyramid

  • Zope => Zope2

  • Zope2 => Zope3 begat BlueBreem

  • BlueBreem => ZTK

  • ZTK => Repoze.BFG (inspired partially by Django)

  • Repoze.BFG => Pyramid

  • RoR possibly begat:

    • Django
    • Pylons
    • TurboGears

Who uses it?

  • Karl Project

Differences between Pyramid and others

Here we go:

Pyramid Django Plone
Not opinionated Opinionated Structured CMS
Very simple Simple Complex
No DB ORM Custom DB

Sample view

from paste.httpserver import serve
from pyramid.configuration import Configuration
from pyramid.response import Response

def hello_world(context, request):
    return Response('Hello world')


config.add_route('myroute', 'me/{one}')
config.add_view(hello_world, route_name='myroute')

View Callables

class MyView(object):
    """ So much more obvious than Django CBVs!"""

    def __init__(self, request):
        # something here I didn't write down

    def __call__(self):
        # why doesn't Django do this?
        raise HttpFound('stuff')


from pyramid.view import view_config

def hello_worldrequest):
    return dict(content="hello")
  • One of the renderers is a jinja2 package.


  • Default: Chameleon (latest version ZPT system)
  • Can use Jinja2 trivially


  • I don’t really care but the Zope fans seem to love it.
  • Works in that you can get things within things
  • Some claim you can’t do this in Django - but they are wrong. See MPTT.


  • Seperation of authentication and authorization.
  • You can easily control the security context of a request
  • Seems to rely natively on ACL, but you can replace that if you want
# TODO - add example
config.add_view(myview, name='my-view.html', )

See the fun of:

class Blog(object):

blog = Blog()

blog.__acl__ = [
    (Allow, Everyone, 'view'),
    (Allow, Editors, 'edit'),
    (Allow, Editors, 'delete'),



  • Provides a default best practices project layout. Why doesn’t Django do this?!?
  • Very obvious static directory

How Django does it better

  • Django’s consistent persistence system means easier to cook up reusable apps