0

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?

zhongshu
  • 7,748
  • 8
  • 41
  • 54
  • Duplicate: http://stackoverflow.com/questions/844570/web-application-background-processes-newbie-design-question, http://stackoverflow.com/questions/1081340/how-do-you-do-something-after-you-render-the-view-django, http://stackoverflow.com/questions/1986060/where-should-i-place-the-one-time-operation-operation-in-the-django-framework – S.Lott Jan 03 '10 at 12:34

2 Answers2

7

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.

Daniel Roseman
  • 588,541
  • 66
  • 880
  • 895
0

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.

CodeBlock
  • 198
  • 1
  • 8