Version 6 (modified by Fran Boon, 11 years ago) ( diff )




Templates allow selecting alternate configuration sets.

This allows a separation between Core Code & Settings/Custom Code.

This helps prevent merge conflicts between different deployment branches & hence reduces the risk of forking.


Configuration is done using these files:

  • /private/templates/
  • /private/templates/default/
  • /private/templates/<template>/

During 1st_run, is copied to models/ includes:

  • machine-specific configuration (Debug, Database, SMTP, API Keys, etc)
  • a setting to define which template folder to run
  • importing of settings from templates/<template>/
  • optional local overrides to the template's settings

Prepopulate Data

Prepopulate options are defined in the template's (ut can be overridden in the running



By default these files are used:

  • /private/templates/default/views/layout.html

in non-Debug mode:

  • /static/styles/default/sahana.min.css

in Debug mode:

  • /private/templates/default/style.cfg
  • /static/styles/default/layout.css
  • /static/styles/S3/sahana.css

User Theme

Optionally a template's (or running can specify a 'theme' folder (usually the same as the template folder), so that these are used instead:

  • /private/templates/<theme>/views/layout.html

in non-Debug mode:

  • static/styles/<theme>/sahana.min.css

in Debug mode:

  • /private/templates/<theme>/style.cfg
  • /static/styles/<theme>/layout.css
  • /static/styles/S3/sahana.css (this file should generally not be changed by deployments)
  • /static/styles/<theme>/style.css (for overrides to core CSS)

By convention, suporting files specific to this theme should be placed in:

  • static/styles/<theme>/*.css
  • static/img/<theme>/*.png

sahana.min.css gets built from style.cfg by static/scripts/tools/

NB Production sites who wish to compile their code either need to hardcode the theme name in their views/layout.html & views/style.html or upgrade to Web2Py version: 2.00.0 (2012-06-17 23:36:32) or newer


  • controllers/ index()
    • Make a controller which can create arbitrary pages based on args &/or vars
  • modules/eden/ & modules/eden/



Note: See TracWiki for help on using the wiki.