Comments:"Intro to the Python Framework Pyramid — Six Feet Up, Inc."
URL:http://www.sixfeetup.com/blog/intro-to-the-python-framework-pyramid-and-a-sample-app
We prefer Pyramid to Django, Flask, and Bottle due to its flexibility, scalability and speed. It gives us more control than Django and is easy to create a small app that can scale later without being rewritten. These are many of the same reasons for Why We Choose Python in general.
Recently we provided some training on how Pyramid works that was recorded. It provides a great overview of why Pyramid is ideal and how to setup a basic app with scaffolds, routes, and persistence. We also built a ToDo App for a web shootout we organized in Indianapolis through IndyPy. Putting these together turned out to be a great introduction to Pyramid, so I wrote this post.
To get a good understanding of the Pyramid framework and see how to implement a basic ToDo app from scratch:
Watch our Intro to Pyramid video below (21 min) Play with the ToDo app demo at http://demo.todo.sixfeetup.com/ Read the step by step instructions in the ToDo app README.md at https://github.com/indypy/todopyramid Checkout the official documentation and tutorials at http://docs.pylonsproject.org/en/latest/docs/pyramid.htmlIf you would like to discuss Six Feet Up building your next web application, contact us or signup for our newsletter to get more articles like this.
If you are looking for a an in depth comparison of Pyramid vs. other frameworks check out Why We Choose Pyramid for Rapid Web Development Projects.
Here are some key points from the video:
General Info
Pyramid is a Python based open source web framework. According to the project's website:
As a framework, its primary job is to make it easier for a developer to create an arbitrary web application. The type of application being created isn’t really important; it could be a spreadsheet, a corporate intranet, or a social networking platform. Pyramid is general enough that it can be used in a wide variety of circumstances.The Pyramid tenets are:
- Simplicity
- Minimalism
- Documentation
- Speed
- Reliability
- Openness
Pyramid is based on Zope, Pylons, and Django. It supports small and large projects so there is no need to rewrite like you would with small frameworks. It's also the fastest Python web framework.
The Pyramid Configuration Supports:
- imperative configuration
- conflict detection
- extensibility
- flexible authentication and authorization policies
- programmatic introspection
Scaffolding and Templating
Pyramid comes with several basic scaffolds to get you started and lets you pick your preferred templating system. Chameleon, Mako, Jinja 2 and others are supported.
Persistence
Pyramid lets you pick whatever persistence method you prefer and supports ZODB and SQLAlchemy. You could also use MongoDB, PostgreSQL and others.
Additional Resources
Pyramid 1.4 Docs - http://docs.pylonsproject.org/projects/pyramid/en/1.4-branch/
Pyramid Denials - http://docs.pylonsproject.org/en/latest/denials/pyramid.html