The Pyramid Web Application Development Framework

Pyramid is a small, fast, down-to-earth Python web application development framework. It is developed as part of the Pylons Project. It is licensed under a BSD-like license.

Here is one of the simplest Pyramid applications you can make:

from wsgiref.simple_server import make_server
from pyramid.config import Configurator
from pyramid.response import Response


def hello_world(request):
    return Response('Hello %(name)s!' % request.matchdict)

if __name__ == '__main__':
    config = Configurator()
    config.add_route('hello', '/hello/{name}')
    config.add_view(hello_world, route_name='hello')
    app = config.make_wsgi_app()
    server = make_server('0.0.0.0', 8080, app)
    server.serve_forever()
   

After you install Pyramid and run this application, when you visit http://localhost:8080/hello/world in a browser, you will see the text Hello, world!

See Creating Your First Pyramid Application for a full explanation of how this application works. Read the Narrative documentation to understand how Pyramid is designed to scale from simple applications like this to very large web applications.

Narrative documentation

Narrative documentation in chapter form explaining how to use Pyramid.

Sample Applications

cluegun is a simple pastebin application based on Rocky Burt’s ClueBin. It demonstrates form processing, security, and the use of ZODB within a Pyramid application. Check this application out via:

git clone git://github.com/Pylons/cluegun.git

virginia is a very simple dynamic file rendering application. It is willing to render structured text documents, HTML documents, and images from a filesystem directory. It’s also a good example of traversal. An earlier version of this application runs the repoze.org website. Check this application out via:

git clone git://github.com/Pylons/virginia.git

shootout is an example “idea competition” application by Carlos de la Guardia and Lukasz Fidosz. It demonstrates URL dispatch, simple authentication, integration with SQLAlchemy and pyramid_simpleform. Check this application out of version control via:

git clone git://github.com/Pylons/shootout.git

KARL is a moderately-sized application (roughly 80K lines of Python code) built on top of Pyramid. It is an open source web system for collaboration, organizational intranets, and knowledge management. It provides facilities for wikis, calendars, manuals, searching, tagging, commenting, and file uploads. See the KARL site for download and installation details.

Support and Development

The Pylons Project web site is the main online source of Pyramid support and development information.

To report bugs, use the issue tracker.

If you’ve got questions that aren’t answered by this documentation, contact the Pylons-discuss maillist or join the #pyramid IRC channel.

Browse and check out tagged and trunk versions of Pyramid via the Pyramid GitHub repository. To check out the trunk via git, use this command:

git clone git@github.com:Pylons/pyramid.git

To find out how to become a contributor to Pyramid, please see the contributor’s section of the documentation.

Index and Glossary