Version 35 (modified by Fran Boon, 14 years ago) ( diff )

Web2Py Wizard

Blueprint for Web Setup


Video Demo:




We need to think about how we package this since it's designed as a parallel app to eden, so would normally sit at the same level as the current repo's root folder. Don't really want to move the root up one as then we'll find it harder to maintain parallel app versions.

Thinking about storing it within /eden but then having it copy this stuff out to the root applications folder on run, if it's not there already....thinking about how it updates that version & how we'd manage with eden, eden2, eden_test as alternate app versions...

I'm thinking we could just have 'eden/private/setup' copied to 'setup'. This could be done if a flag is set in deployment settings to do this. This should be the first flag read:

deployment_settings.base.websetup = True

If True then copy all the files from private to the new app & redirect user there. Once websetup has completed then change this flag to False. From thenceforth users would only get back to websetup if they explicitly requested it, which could be done via the admin menu.


I think we should look to redesign this somewhat:

  1. Pull all setting options from & current settings from

Remember that the idea is that web setup can be run after the initial install to make subsequent settings changes (ideally just single pages, but skipping unchanged pages via Next is fine for now). The validation for fields needs to be pushed back into s3cfg so that these get maintained together & can be read by setup when it imports from there (other than what you're doing in the view for password & HMAC key - these can stay as-is).

  1. Don't do a full write-out of the 000_config file.

Instead just touch what we know - i.e. parse the existing file & just change lines that we know. If a line doesn't exist (either commented or active) then can add it from the information in s3cfg. If a line does exist (either commented or active) then can uncomment & set to what has been requested. All other lines should be ignored. This would seem a more robust, less intrusive system. I can foresee that deployers will add their own customisations into 000_config & won't push this into s3cfg or setup & will get upset if their customisations disappear...


  • all user-visible strings should be wrapped in T()

Other things to include

Other Options

Web2Py now has a Wizard setup from which ideas (& maybe code?) can be borrowed:


Provide a 1st-time configuration screen.

Setting the 1st username/password here & then running models/ means that:

  • User can be given admin rights even on databases which support referential integrity.
    • MySQL can:
      do import

Configuration settings are in the file models/ which will have a simple structured format.

  • models/ reads these settings to do the actual configuration.
  • The Web Setup should ideally read in the file, make any amendments as-required & then write it out.
  • This means that developers can edit the settings live (we remain RAD) & there are no unncessary DB calls every request.
  • Ideally the Web setup should have a UI which works via introspection, so doesn't need to be maintained separately when settings are added/amended (this means the settings file needs to include labels/help text).
  • instantiates the S3Config class as deployment_settings:
    • S3Config is a subclass of Storage and can therefore be written in dot-notation
    • S3Config implements methods to read the config values (instead of accessing the instance attributes themselves), which also implement any fallback values. These methods should be used throughout the application (=do not store their return values in any global variables).
    • additionally, a S3Config instance could (should) be made read-only during the current request (=safer) by amending the __setattr__ method to not accept updates
    • S3Config could contain a method to generate a web form to create a new instance (+pre-populate the form with values of another instance)
    • S3Config could then even contain a method to write the instance to a config file like

There should be an option to be able to run with settings in the DB instead of config file to support:

  • Load-balanced webservers
  • GAE

Provide an option to import themes of settings (e.g. 'FEMA') using shn_import from CSV files in private/import:

  • Symbology (icons on maps)
  • Terminology of Labels
  • Forms used (which fields are used, which are mandatory, etc)
  • Which modules are active

Sahana Phase2 version:


Note: See TracWiki for help on using the wiki.