Changes between Version 85 and Version 86 of DeveloperGuidelines
- Timestamp:
- 03/24/10 22:18:17 (15 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
DeveloperGuidelines
v85 v86 1 1 [[TOC]] 2 = Developer Guide = 2 3 == Understand the Sahana mission == 3 4 Before you start on the Sahana project, understand clearly what the project is about and what it strives to accomplish. You can find most of this in the Sahana [http://www.sahana.lk/overview Overview and objectives] … … 9 10 InstallationGuidelinesDeveloper 10 11 11 == Python == 12 == Introduction == 13 14 === Python === 12 15 Indentation matters (use 4 spaces instead of Tabs) 13 16 * http://diveintopython.org/ … … 19 22 More details at: DeveloperGuidelinesCodeConventions 20 23 21 == Web2Py==24 === Web2Py === 22 25 This is an [http://en.wikipedia.org/wiki/Model-view-controller MVC] environment (like [http://web2py.com/AlterEgo/default/show/103 Rails] & [http://web2py.com/AlterEgo/default/show/101 Django]. [http://vimeo.com/6507384 Django polls turorial conversion course]). 23 26 … … 30 33 python web2py.py -S sahana -M 31 34 }}} 32 === Model===35 ==== Model ==== 33 36 Defines databases in: {{{/models/module.py}}} 34 37 … … 37 40 The Models are imported in alphabetical order, so we load the files which other modules depend on 1st, hence naming them appropriately:[[BR]]{{{00_db.py}}}, {{{01_RESTlike_controller.py}}}, {{{02_pr.py}}}, {{{03_gis.py}}} 38 41 39 === Controller===42 ==== Controller ==== 40 43 Python functions in {{{/controllers/module.py}}} [[BR]] 41 44 e.g. … … 46 49 }}} 47 50 48 === View===51 ==== View ==== 49 52 HTML/Javascript templates in {{{/views/module/function.html}}} 50 53 * these are normal HTML/JS files with the ability to add in Python code (e.g. variables) surrounded by brackets: {{ interpreted python here }} … … 55 58 Static CSS/Javascript files are stored in {{{/static}}} 56 59 57 == Javascript==60 === Javascript === 58 61 * jQuery is used for client-side business logic (hiding fields, opening up tabs, etc): 59 62 * Tutorial 1: http://docs.jquery.com/Tutorials:How_jQuery_Works … … 70 73 * W3Schools' basic JS: http://www.w3schools.com/js/ 71 74 72 == Reserved Keywords==75 === Reserved Keywords === 73 76 * 'request' -> web2py internal use 74 77 * 'key' as a db row name -> MySQL confuses it with internal keyword KEY … … 76 79 * http://www.postgresql.org/docs/8.1/static/sql-keywords-appendix.html 77 80 81 == Other Guidelines == 78 82 79 == Guidelines ==80 83 * WSGI likes print statements to go to {{{sys.stderr}}} not {{{sys.stdout}}}: http://code.google.com/p/modwsgi/wiki/DebuggingTechniques 81 84