Right way to have a thread in parallel to django project on wsgi.

Posted by Enrico Carlesso on Stack Overflow See other posts from Stack Overflow or by Enrico Carlesso
Published on 2010-05-31T13:52:10Z Indexed on 2010/05/31 17:23 UTC
Read the original article Hit count: 308

Filed under:
|
|
|

Hi guys.

I'm writing a django project, and I need to have a parallel thread which performs certain tasks.

The project will be deployed in Apache2.2 with mod_wsgi.

Actually my implementation consists on a thread with a while True - Sleep which is called from my django.wsgi file.

Is this implementation correct?

Two problems raises: does django.wsgi get called only once? Will I have just that instance of the thread running? And second, I need to "manually" visit at least a page to have the Thread run. Is there a workaround?

Does anyone has some hints on better solutions?

Thanks in advance.

© Stack Overflow or respective owner

Related posts about django

Related posts about threading