Sahana Eden

Further Reading

This manual is not designed to teach you Python, Web2Py, or Javascript as we encourage you to dive straight into Sahana Eden code to learn as you go. However this chapters provide additional reference resources for those who wish to get additional skills for more significant code changes.

Python

Python is a high-level scripting language suitable for rapid application development. It has a wealth of powerful libraries available. If you're interested in learning more about Python outside of our code, refer to these excellent Python resources:

Web2Py

Web2Py is a simple yet powerful framework to allow people to rapidly develop secure real world applications. We like the Official Web2Py book (http://web2py.com/book) as a resource.

Here are a few tips about Web2Py:

  1. All Models are executed during every request in alphabetical order within web2py environment
  2. The Controller is executed
  3. The View template is parsed
  4. (HTML) page returned to client

Tip 1: Python Modules are not reloaded for every request, so if changes are made to these files then you would need to restart Web2Py to see the differences.

Tip 2: Because all the models are executed during every request, the code added there should be optimized - search for 'conditional model loading' in the code for guidance on how to do this. 

JavaScript

Sahana Eden uses two JavaScript libraries: jQuery and ExtJS.

jQuery offers a simple way of adding unobtrusive client-side interactivity to widgets. It has a wealth of plugins available (some of which we copy to static/scripts/S3, the Amazon Simple Storage Service) and excellent documentation at http://docs.jquery.com

ExtJS provides some very advanced UI components that are primarily used for the Map. It has a wealth of plugins available (some of which we copy to static/scripts/S3, the Amazon Simple Storage Service) and excellent documentation at http://docs.sencha.com/ext-js/3-4/.

Sahana Eden Build and Debug Tips

For end-user performance gains, Sahana Eden minimizes and compresses the CSS and JavaScript. While this approach works well for optimized end-user performance, to debug the CSS and JavaScript you should enable debug mode in models/000_config.py  in your Sahana Eden server with the following setting:

settings.base.debug = True

Once any changes to the CSS and JavaScript are working, then you can minimizes and compresses the CSS and JavaScript using:

static/scripts/tools/build.sahana.py

Although this uses a web service, you get better results by downloading a local version of the Closure Compiler (a tool for making JavaScript download and run faster) to static/scripts/tools.

Tip: It is also possible to quickly view a single page in debug mode by adding the ?debug=1 variable to the end of a URL.