On Fri, 2007-09-28 at 22:34 -0600, staff-gmail wrote: > James Bennett wrote: > > On 9/28/07, Mark Green <[EMAIL PROTECTED]> wrote: > > > >> i'm looking for a way to perform a bunch of initialization tasks > >> right after django startup. > >> > > > > There really is no such thing as "Django startup"; remember that > > Django is hosted inside a web server, and that server processes will > > come and go over time with no real concept of anything persisting > > beyond the life of a process, unless you serialize out to an external > > store (such as your database, or a file, or memcached). And then > > you'll want to be very careful in how you "initialize", because that's > > probably going to happen every time a server process is started, and > > you'll need to take care that you're not unnecessarily regenerating or > > recalculating something when you could load it from something > > external. > > > > Not sure what you are trying to initialize, but you could call an > initialization method from your initial view method. If it is like a > new game or new project or new whatever - I have the user click on a > start button which then calls a function (in the project or game or > whatever model) that retrieves or resets a bunch of variables and > creates a new object from that model. Likewise I have some initialize > functions in models that create new "seed" data for a new account and > are called and executed from the on-submit method that is specified in > the login form. Is that what you are trying to do?
Thanks for the idea but my needs are a bit more low-level I think. In particular I need to start up (and maintain over the lifetime of the django instance) a tcp connection to our messaging broker for later use from views-code. -mark --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---