Re: Execute code which runs on the database only when the server is running - and doesn't need users to view pages.

2016-01-11 Thread Andreas Kuhne
Oh ok, Sorry I misunderstood your problem. How about running the celery task and then checking if http://localhost is up? Regards, Andréas 2016-01-11 13:31 GMT+01:00 Tony Flury : > Andreas, > > Thanks for your answer. Certainly it looks like running celery might > alleviate the issue with thre

Re: Execute code which runs on the database only when the server is running - and doesn't need users to view pages.

2016-01-11 Thread Tony Flury
Andreas, Thanks for your answer. Certainly it looks like running celery might alleviate the issue with threading stopping the management commands, but the problem with your suggestion lies with that flag. If My code was able to identify that the server is running to the point of being able to s

Re: Execute code which runs on the database only when the server is running - and doesn't need users to view pages.

2016-01-11 Thread Andreas Kuhne
Hi, Wouldn't it be possible to use celery and tasks for this purpose? http://www.celeryproject.org/ You could have it running all the time and have a flag in the database for when the server is running? Regards, Andréas 2016-01-11 9:59 GMT+01:00 Tony Flury : > I have a small background task (

Execute code which runs on the database only when the server is running - and doesn't need users to view pages.

2016-01-11 Thread Tony Flury
I have a small background task (executed by using threading.Timer) which I want to start up when the server starts, but doesn't need to start when a management command runs. The background task performs operations on the database, so relies on importing the models etc. I have tried using the A