== Install a Development Environment == InstallationGuidelinesDeveloper == Python == Indentation matters (use 4 spaces instead of Tabs) * http://diveintopython.org/ * http://openbookproject.net/thinkcs/python/english2e/ * Style Guide: http://www.python.org/dev/peps/pep-0008/ == Web2Py == This is an [http://en.wikipedia.org/wiki/Model-view-controller MVC] environment (like [http://mdp.cti.depaul.edu/AlterEgo/default/show/103 Rails] & [http://mdp.cti.depaul.edu/AlterEgo/default/show/101 Django]). Web2Py can work at several different levels of abstraction.[[BR]] The !SahanaPy framework (S3) is built on a mixture of the simplified T2 level & Web2Py's Auth/Crud classes in {{{tools.py}}}, however sometimes we need more control therefore need to drop down a level or two.[[BR]] Web2py also includes a T3 level of abstraction, but we're not using that directly (just borrowing ideas). * Web2Py: * Official Manual (costs money): http://www.lulu.com/content/4968879 * http://www.vimeo.com/3703345 * http://mdp.cti.depaul.edu/examples/static/cookbook.pdf * http://mdp.cti.depaul.edu/examples/static/web2py_cheatsheet.pdf * http://mdp.cti.depaul.edu/examples/default/examples * http://mdp.cti.depaul.edu/examples/default/tools * http://mdp.cti.depaul.edu/examples/default/dal * http://mdp.cti.depaul.edu/examples/static/epydoc/index.html * T2: * http://mdp.cti.depaul.edu/examples/static/t2.pdf * http://dl.getdropbox.com/u/169957/t3_cheatsheet.pdf === Model === Defines databases in: {{{/models/module.py}}} The Models are loaded 1st within Web2Py processing, before the controllers.[[BR]] So you can import any global modules/set any global variables here.[[BR]] The Models are imported in alphabetical order, so we load the files which other modules depend on 1st, hence naming them with an underscore:[[BR]]{{{_db.py}}}, {{{_gis.py}}} === Controller === Python functions in {{{/controllers/module.py}}} [[BR]] e.g. {{{ def list_records(): items=t2.itemize(table) return dict(items=items) }}} === View === HTML/Javascript templates in {{{/views/module/function.html}}} * these are normal HTML/JS files with the ability to add in Python code (e.g. variables) surrounded by brackets: {{ interpreted python here }} * there should be an .html file available for each function in the module (name normally being the same as the function) * these normally inherit from {{{views/layout.html}}} which also includes the !JavaScript from {{{views/*_ajax.html}}} * if there is no view defined then a default view will be displayed, which will show the values of all the data it can see, but not be formatted nicely Static CSS/Javascript files are stored in {{{/static}}} * [wiki:DeveloperGuidelinesS3Framework SahanaPy Framework: S3] * [wiki:DeveloperGuidelinesSahana2Migration Help for Developers Migrating from Sahana2] * [wiki:DeveloperGuidelinesNewModule How to add a new Module?] * [wiki:DeveloperGuidelinesBzr Using Bzr] * [wiki:DeveloperGuidelinesGIS GIS] * [wiki:DeveloperGuidelinesLibraries Libraries] * [wiki:DeveloperGuidelinesWebServices Web Services] * [wiki:DeveloperGuidelinesArchitecture Architecture] * [wiki:DeveloperGuidelinesDocumentation Documentation] * [wiki:DeveloperGuidelinesTesting Testing] * [wiki:DeveloperGuidelinesOptimisation Optimisation] * [wiki:DeveloperGuidelinesReleaseProcess Release Process] * [wiki:DeveloperGuidelinesTips Tips] - useful links to explore [[TranslatedPages]]