Re: Where/how to load global static data?

2012-04-05 Thread Tom Evans
On Thu, Apr 5, 2012 at 4:20 PM, bruno desthuilliers wrote: > On Apr 5, 3:11 pm, Tom Evans wrote: >> >> OP: I have a couple of solutions. One of the first things the server >> does is import your settings, so if you load and parse your

Re: Where/how to load global static data?

2012-04-05 Thread bruno desthuilliers
On Apr 5, 3:11 pm, Tom Evans wrote: > > OP: I have a couple of solutions. One of the first things the server > does is import your settings, so if you load and parse your static > data at that point, then you will have access to it from that point > onwards. Please

Re: Where/how to load global static data?

2012-04-05 Thread Tom Evans
On Thu, Apr 5, 2012 at 2:45 PM, Lars Ruoff wrote: > Thanks a lot, Tom. > That magnificantly answers my question. :-) > > One last thing: > > "... a function which loads, parses and returns > the data, and memoize the result." > > That (and the first option also) means that

Re: Where/how to load global static data?

2012-04-05 Thread Lars Ruoff
Thanks a lot, Tom. That magnificantly answers my question. :-) One last thing: "... a function which loads, parses and returns the data, and memoize the result." That (and the first option also) means that we stay within the same Python interpreter environment even for different requests to the

Re: Where/how to load global static data?

2012-04-05 Thread Tom Evans
On Thu, Apr 5, 2012 at 1:31 PM, kenneth gonsalves wrote: > On Thu, 2012-04-05 at 05:25 -0700, Lars Ruoff wrote: >> the question is not about serving static data (like HTML, images >> etc.), but having global python variables initialized once, for all >> instances of the

Re: Where/how to load global static data?

2012-04-05 Thread Lars Ruoff
On Apr 5, 2:31 pm, kenneth gonsalves wrote: > On Thu, 2012-04-05 at 05:25 -0700, Lars Ruoff wrote: > > the question is not about serving static data (like HTML, images > > etc.), but having global python variables initialized once, for all > > instances of the site, that

Re: Where/how to load global static data?

2012-04-05 Thread kenneth gonsalves
On Thu, 2012-04-05 at 05:25 -0700, Lars Ruoff wrote: > the question is not about serving static data (like HTML, images > etc.), but having global python variables initialized once, for all > instances of the site, that is, so they can be used from within each > view. this is precisely the point

Re: Where/how to load global static data?

2012-04-05 Thread Lars Ruoff
On Apr 5, 9:05 am, kenneth gonsalves wrote: > I may be wrong, but AFAIK django is not a server - it is a framework > that runs on a web server, so every new request starts a new instance of > your site. You could use cacheing to serve static data - but this is not > like

Re: Where/how to load global static data?

2012-04-05 Thread kenneth gonsalves
On Wed, 2012-04-04 at 23:56 -0700, Lars Ruoff wrote: > I'd like to know where to put the code that reads these files and > initialzes the global data once and for all at server startup. > I.e. i'd like to have that data in memory and accessible from any > view > during the lifetime of the server,

Where/how to load global static data?

2012-04-05 Thread Lars Ruoff
Hi, i'm using Django the first time for a browser game project. I will need to have some globally accessible, static data like string tables for every view. These would be loaded from XML files. For the moment all i have figured out with Django is that my code will be called via callbacks for the