thanks, Anthony. In case that's the way to go: could this be added somewhere to the official documentation? I think that's really important and it is not obvious for non-python-experts (like me).
Alex Am Freitag, 6. April 2012 15:44:43 UTC+2 schrieb Anthony: > > could you explain how this would look in detail? >> So I would have a file called settings.py in the modules folder and the >> following content: >> dbconnection = '...' >> >> in my model files I could access the variable dbconnection, right? >> > > Yes, but of course you have to import the settings module first. Maybe at > the beginning of your first model file (they are executed alphabetically), > do: > > from gluon.custom_import import track_changes; track_changes(True) > import settings > > Then subsequently in any model files, controllers, or views, you can > access settings.dbconnection, etc. > > >> settings.py is only loaded once (I'm not that familiar with modules)? >> > > Yes, it should be (though with track_changes(True) it will automatically > be reloaded whenever it changes). > > >> does this also work with compiled applications? >> > > It should. > > >> and with (external) cron jobs? >> > > I believe so, as long as the job runs the application models (where the > settings are imported). I suppose it could also import the settings > directly. > > Anthony >