zhongshu
zhongshu

Reputation: 7878

how to start a thread when django runserver?

I want to start a thread when django project runserver successfully. where can I put the create-thread-and-start code? Is there any hook for the django runserver?

Upvotes: 0

Views: 2971

Answers (2)

CodeBlock
CodeBlock

Reputation: 198

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.

Upvotes: 0

Daniel Roseman
Daniel Roseman

Reputation: 599450

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.

Upvotes: 7

Related Questions