开发者

Django - Threading in views without hanging the server

One of my applications in my Django project require each request/visitor to that instance to have their own thread. This might sound confusing, so I'll describe what I'm looking to accomplish in a case based scenario, with steps:

  1. User 开发者_StackOverflow社区visits application
  2. Thread starts
  3. Until the thread finishes, that user's server instance hangs
  4. Once the thread completes, a response is delivered to the user
  5. Other visitors to the site should not be affected by any other users using the application

How can I accomplish something like this? If possible, I'd like to find a lightweight solution.


But why you need thread? why can't you just do whatever you want to do in django view?

If you are using servers like apache with mod-wsgi you should be able to have good control over number of process and threads , so that part shouldn't be your worry or should not be in django views.


I dread to think why you'd want to do that.

Are you sure you're not looking for session variables?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜