@Massimo- Thank you, I understand the practice but still not the prescription. By turning the app on/off you mean disable/enable? Don't all apps live in the same site-wide Python process, and wouldn't that mean that the global objects would remain?
On Tuesday, May 1, 2012 9:40:00 AM UTC-4, Massimo Di Pierro wrote: > > Models and controllers are executed at every request therefore it is safe > to change them while the app is running. Web2py handles them the way it > does to allow you how replacement. > > Python modules - in general - should not be replaced without turning the > app off and on again. > It really depends on the module and this is not a web2py specific issue. A > module may define a global object and if you reload the module you end up > with two of those objects. Depending on how it is used this may have > unintended consequences. The fact that you technically can force python to > reload a module does not mean that is good practice in general. > > > > > On Tuesday, 1 May 2012 08:18:45 UTC-5, Yarin wrote: >> >> @Massimo- you're saying a production application should not reload >> modules, but then what is the correct process for updating an app in >> production - i.e. installing an app by overwriting an old one - if it has >> modules that have changed? >> >> On Sunday, April 29, 2012 12:02:52 PM UTC-4, Massimo Di Pierro wrote: >>> >>> Let's clarify something.... >>> >>> web2py always uses the most comment models/controllers/views. >>> web2py (as Python does) loads modules onces and keeps them in memory, >>> even when modules are shipped with the app. >>> The fact that >>> >>> from gluon.custom_import import track_changes; track_changes(True) >>> >>> overrides this behavior if a feature to be used in development, not in >>> production. >>> >>> Reloading modules is a bad idea. It has performance penalties and can >>> cause undesired effects because of global objects defined in the modules. >>> A production application should not do this. >>> >>> >>> >>> On Sunday, 29 April 2012 08:34:26 UTC-5, Yarin wrote: >>>> >>>> Got to say this is scary- we're about to go into production with our >>>> first web2py app, and having erratic module behavior persist across server >>>> restarts is not something we signed up for. Please let's address this. >>>> >>>> On Sunday, April 29, 2012 9:12:55 AM UTC-4, Yarin wrote: >>>>> >>>>> @Bruno- Thanks for confirming this issue >>>>> @Anthony - Thoughts? >>>>> >>>>> >>>>>>