The problem is that first start is a very relative term depending on how you run web2py, it's not the same for standalone/cherrypy, CGI, MOD_WSGI, parallel versions of these, etc. This means that your startup code could be executed in a whole lot of places, not always where you want it. You also have to make arrangements for race conditions (what if a web request comes in while you are executing your startup function?)
As an idea, you might want to check/set a flag variable in cache.ram. If you don't see that flag, presume it's a first start, if it is there, consider yourself loaded. This also can lead to a few gotcha's (use mutexes to prevent race conditions) and doesn't work with CGI, but until somebody suggests something better, it might be worth a try. On Jan 27, 5:44 am, billf <billferr...@blueyonder.co.uk> wrote: > Basically, is there any code that receives control when an application > first starts that allows some initialisation/configuration that > doesn't have to run after every request? > > I believe code could be put in db.py but that is not ideal > conceptually - and would run on every request? > > I can see that there are pros and cons to the idea of "on start" code > and would be interested in peoples' views. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---