Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Decouple web-specific code from the models, libraries, and apis, so that the components can be used independently.
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.


An unofficial scaffolding for Pyramid. Recommended for advanced Pyramid or Pylons developers.

Contains somewhat opinionated examples that can be easily replaced.


  • Decoupled components: Use the project pieces independently of the web component.
  • Inspired by the original Pylons project structure and the pyramid_routesalchemy paster template.
  • Includes a reasonable CSS reset and an inheritance-based Mako template setup.
  • SQLAlchemy-compatible but not setup out of the box.
  • No hidden code in files.
  • All the web-related setup happens in {{project}}/web/



 $ pip install
 $ pcreate --list
 Available scaffolds:
   alchemy:           Pyramid SQLAlchemy project using url dispatch
-> pyramid_decoupled: Decouple web-specific code from the rest (models, library api, etc).
   starter:           Pyramid starter project
   zodb:              Pyramid ZODB project using traversal

Create a project:

$ pcreate -s pyramid_decoupled foo
$ cd foo
$ find .
./foo/lib/           <- Available as 'h' in templates.
./foo/models/       <- Unopinionated model submodule with a
./foo/models/              moderately advanced example setup.
./foo/web/       <- Setup like routes lives here.

Start the server:

$ python develop
... (Installs dependencies like pyramid-debugtoolbar, waitress, etc.)
$ pserve development.ini
Starting server in PID 32481.
serving on

Suggested Structure

I'll usually build a context-insensitive API library in {{project}}/api/, so that I can do things like:

>>> import foo.api
>>> foo.api.account.change_password(user='foo', password='bar')
>>> r = foo.api.inventory.list(limit=20)

The api generally uses the model to do things.

This way, most of the business logic lives in the API library and is easily used by daemons, tests, or web views.


  • Add pyramid.i18n.TranslationStringFactory stuff.
  • Maybe add optional TurboMail/marrow.mailer example?
  • Useful example for the api structure
  • More documentation
Something went wrong with that request. Please try again.