Question

I have a Python 2.6 web app built on Pylons 0.9.7. The code in my controller only runs the first time a client requests it, which is fair enough, but is there any way I can run some code as soon as the server starts and is ready to accept requests, without waiting until a request is actually received?

Was it helpful?

Solution

It's an environment setting, if that's what you're asking.

Specifically: lib/app_globals, modify _ _ init _ _ (). (Ignore the spaces there, silly emboldening function!)

See: http://pylonshq.com/docs/en/0.9.7/configuration/#environment

Alternative methods are getting your helper script (that which is launching the server) to run it prior to running the site.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top