> I am new to web2py (I've been using Django), and I am confused about a couple of things.

Welcome to web2py.

> First, the presence of multiple controllers.

Every time a function in the controller is called the whole file is compiled. By having smaller controller you get an faster application. If I have e.g. five options in mainmenu I create five different controllers.

All .py files in models directory is processed for every request. So you can have everything in one file or in 20 files. Files are processed in alphabetical order.

I have made four files, 1_db_settings (name of the database, password and so on), 2_database (table declarations), 3_functions (if needed I create functions that can be used in every controller), 4_meny (declaration of the meny).

Hope this helps a bit.


Kenneth
Second, in the default setup, I see db.py and menu.py. In db.py it is noted that I should really add my table declarations to another model file. But, all the logic to decide if web2py is running on appengine or not, etc, is all in db.py; if I write my table declarations in another file, do I have to cut and paste that logic? Or how is this supposed to work? All the example in the tutorial just edit db.py.

Many thanks! --Luca


Reply via email to