Skip to content
Decouple web-specific code from the models, libraries, and apis, so that the components can be used independently.
Find file
Latest commit d9f225c Apr 16, 2012 @shazow marrow note.
Failed to load latest commit information.
pyramid_scaffolds_decoupled objects __all__ Apr 16, 2012
.gitignore README Sep 29, 2011
LICENSE Ready. Sep 29, 2011
README Importing. Sep 29, 2011
README.rst marrow note. Apr 16, 2012 More opinionated (added SQLAlchemy base with example). Apr 16, 2012


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.