Version 38 (modified by 16 years ago) ( diff ) | ,
---|
Install a Development Environment
InstallationGuidelinesDeveloper
Python
Indentation matters (use 4 spaces instead of Tabs)
Web2Py
This is an MVC environment (like Rails & Django).
Web2Py can work at several different levels of abstraction.
The Sahana 3 (S3) framework is mainly built on the simplified T2 level, however sometimes we need more control therefore need to drop down a level or two.
Web2py also includes a T3 level of abstraction, but we're not using that currently.
- T2 level:
- Lower level:
Model
Defines databases in: /models/module.py
The Models are loaded 1st within Web2Py processing, before the controllers.
So you can import any global modules/set any global variables here.
The Models are imported in alphabetical order, so we load the files which other modules depend on 1st, hence naming them with an underscore:_db.py
, _gis.py
Controller
Python functions in /controllers/module.py
e.g.
def list_records(): list=t2.itemize(table) return dict (list=list)
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 fromviews/*_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
- Sahana3 Framework
- Help for Sahana2 Developers
- How to add a new Module?
- Web Services
- GIS
- Testing
- Using Bzr
- How to update Web2Py?
- Release Process
- Tips - useful links to explore