how to start a thread when django runserver?
I want to start a thread when django project runs开发者_JAVA百科erver successfully. where can I put the create-thread-and-start code? Is there any hook for the django runserver?
Why would you want to do that? runserver is for development only, it should never be used in production. And if you're running via Apache, it should manage threads/processes for you anyway.
Agree with the above answer, you probably don't want to do this. Runserver should be used for development only. Once you deploy, you'll want to move to Apache/WSGI. On my dev machine (where I do use runserver), I usually throw it in a screen session, so it doesn't get in the way, but I can pull it back up if I need to see a traceback.
精彩评论