Actually, I was looking at the middleware, because executing the
middleware modules happens once on the first request. If I put
executable code at the top level of a middleware module, I'll get the
effect I'm looking for. Not an elegant solution, though. --Ned. Adrian Holovaty wrote: On 2/15/06, Ned Batchelder <[EMAIL PROTECTED]> wrote:I'd like to perform some one-time actions when the server is started. They would be similar to the "validating models..." that happens when the debug server is started. I'd like these things to happen for both development and real deployed servers. Is there any formal mechanism in Django for me to hook into the startup logic?There's the middleware framework (http://www.djangoproject.com/documentation/middleware/), but those hooks are on a per-request basis, not a per-server basis. We could easily add a hook for you, though. The magic-removal branch has a new dispatching framework (we're using PyDispatcher), so if you're willing to wait for that, we can can add the hook there.Adrian -- Adrian Holovaty holovaty.com | djangoproject.com | chicagocrime.org . -- Ned Batchelder, http://nedbatchelder.com |
- Re: Actions on startup? Ned Batchelder
- Re: Actions on startup? Adrian Holovaty
- Re: Actions on startup? Ned Batchelder